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,11 +26,17 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) {
}
if (leftPaneVisible) {
// Delayed initialization ensures that all DOM elements are fully rendered and part of the layout,
// preventing Split.js from retrieving incorrect dimensions due to #left-pane not being rendered yet,
// which would cause the minSize setting to have no effect.
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]))
});
});
}
}