| 123 | |
| 124 | // Recenter Button Overlay |
| 125 | function showRecenterButton(onClick) { |
| 126 | let btn = document.getElementById('graph-recenter-btn'); |
| 127 | if (!btn) { |
| 128 | btn = document.createElement('button'); |
| 129 | btn.id = 'graph-recenter-btn'; |
| 130 | btn.textContent = 'Recenter'; |
| 131 | btn.style.position = 'absolute'; |
| 132 | btn.style.left = '50%'; |
| 133 | btn.style.top = '50%'; |
| 134 | btn.style.transform = 'translate(-50%, -50%)'; |
| 135 | btn.style.zIndex = 1000; |
| 136 | btn.style.fontSize = '2em'; |
| 137 | btn.style.padding = '0.5em 1.5em'; |
| 138 | btn.style.background = '#fff'; |
| 139 | btn.style.border = '2px solid #2196f3'; |
| 140 | btn.style.borderRadius = '12px'; |
| 141 | btn.style.boxShadow = '0 2px 16px #0002'; |
| 142 | btn.style.cursor = 'pointer'; |
| 143 | btn.style.display = 'block'; |
| 144 | document.getElementById('graph').appendChild(btn); |
| 145 | } |
| 146 | btn.style.display = 'block'; |
| 147 | btn.onclick = function() { |
| 148 | btn.style.display = 'none'; |
| 149 | if (typeof onClick === 'function') onClick(); |
| 150 | }; |
| 151 | } |
| 152 | |
| 153 | function hideRecenterButton() { |
| 154 | const btn = document.getElementById('graph-recenter-btn'); |