MCPcopy Index your code
hub / github.com/python/cpython / initSidebarResize

Function initSidebarResize

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js:747–792  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

745}
746
747function initSidebarResize() {
748 const sidebar = document.getElementById('sidebar');
749 const resizeHandle = document.getElementById('sidebar-resize-handle');
750 if (!sidebar || !resizeHandle) return;
751
752 let isResizing = false;
753 let startX = 0;
754 let startWidth = 0;
755 const minWidth = 200;
756 const maxWidth = 600;
757
758 resizeHandle.addEventListener('mousedown', function(e) {
759 isResizing = true;
760 startX = e.clientX;
761 startWidth = sidebar.offsetWidth;
762 resizeHandle.classList.add('resizing');
763 document.body.classList.add('resizing-sidebar');
764 e.preventDefault();
765 });
766
767 document.addEventListener('mousemove', function(e) {
768 if (!isResizing) return;
769
770 const deltaX = e.clientX - startX;
771 const newWidth = Math.min(Math.max(startWidth + deltaX, minWidth), maxWidth);
772 sidebar.style.width = newWidth + 'px';
773 e.preventDefault();
774 });
775
776 document.addEventListener('mouseup', function() {
777 if (isResizing) {
778 isResizing = false;
779 resizeHandle.classList.remove('resizing');
780 document.body.classList.remove('resizing-sidebar');
781
782 // Save the new width
783 const width = sidebar.offsetWidth;
784 localStorage.setItem('flamegraph-sidebar-width', width);
785
786 // Resize chart after sidebar resize
787 setTimeout(() => {
788 resizeChart();
789 }, 10);
790 }
791 });
792}
793
794// ============================================================================
795// Thread Stats

Callers 1

initFlamegraphFunction · 0.85

Calls 6

resizeChartFunction · 0.85
getElementByIdMethod · 0.80
addMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…