()
| 122 | } |
| 123 | |
| 124 | function toggleSidebar() { |
| 125 | const sidebar = document.getElementById('sidebar'); |
| 126 | if (sidebar) { |
| 127 | const isCollapsing = !sidebar.classList.contains('collapsed'); |
| 128 | |
| 129 | if (isCollapsing) { |
| 130 | // Save current width before collapsing |
| 131 | const currentWidth = sidebar.offsetWidth; |
| 132 | sidebar.dataset.expandedWidth = currentWidth; |
| 133 | localStorage.setItem('flamegraph-sidebar-width', currentWidth); |
| 134 | } else { |
| 135 | // Restore width when expanding |
| 136 | const savedWidth = sidebar.dataset.expandedWidth || localStorage.getItem('flamegraph-sidebar-width'); |
| 137 | if (savedWidth) { |
| 138 | sidebar.style.width = savedWidth + 'px'; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | sidebar.classList.toggle('collapsed'); |
| 143 | localStorage.setItem('flamegraph-sidebar', sidebar.classList.contains('collapsed') ? 'collapsed' : 'expanded'); |
| 144 | |
| 145 | // Resize chart after sidebar animation |
| 146 | setTimeout(() => { |
| 147 | resizeChart(); |
| 148 | }, 300); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | function resizeChart() { |
| 153 | if (window.flamegraphChart && window.flamegraphData) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…