To avoid the left pane from sometimes being resized to a very small width.

This commit is contained in:
SiriusXT 2025-05-10 09:19:41 +08:00
parent a76ca76813
commit bd4ebd3893

View File

@ -26,10 +26,16 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) {
} }
if (leftPaneVisible) { if (leftPaneVisible) {
leftInstance = Split(["#left-pane", "#rest-pane"], { // Delayed initialization ensures that all DOM elements are fully rendered and part of the layout,
sizes: [leftPaneWidth, 100 - leftPaneWidth], // preventing Split.js from retrieving incorrect dimensions due to #left-pane not being rendered yet,
gutterSize: DEFAULT_GUTTER_SIZE, // which would cause the minSize setting to have no effect.
onDragEnd: (sizes) => options.save("leftPaneWidth", Math.round(sizes[0])) requestAnimationFrame(() => {
leftInstance = Split(["#left-pane", "#rest-pane"], {
sizes: [leftPaneWidth, 100 - leftPaneWidth],
gutterSize: DEFAULT_GUTTER_SIZE,
minSize: [150, 300],
onDragEnd: (sizes) => options.save("leftPaneWidth", Math.round(sizes[0]))
});
}); });
} }
} }