From d2217e99f483006a31f0ec81e6c0e4a087d3d16b Mon Sep 17 00:00:00 2001 From: broisnees Date: Tue, 24 Nov 2026 12:07:34 +0000 Subject: [PATCH] Keep panel drags smooth while the terminal is open Dragging the terminal dock, a sidebar or a split pane refit xterm and reallocated the data grid's canvas on every frame, which dropped the drag well below the display rate on Linux, Windows and macOS. beginPanelResize/endPanelResize in panel-motion.js ref-count an active drag, set data-resizing on and fire stroke:panel-resize-end on release. ResizeHandle and PaneLayout call them and use pointer capture with pointercancel and lostpointercapture, so a drag always ends. TerminalPage holds its grid while a drag runs and refits once on release. Its fit() works from xterm's cell size instead of FitAddon.fit(), which forced style recalcs and cleared the renderer before each resize. Window resizes fit at once for a single change and debounce 100ms while the size keeps changing. The PTY hears the final size once. DataTable grows its canvas backing store in 256px steps during a drag and skips the repaint when the viewport only shrank. The terminal dock uses ResizeHandle (wider grab area, double-click resets to 260px) and its height is clamped and persisted in layout.js. --- .changeset/panel-resize-fps.md | 3 + src/app.css | 6 +- src/lib/components/DataTable.svelte | 37 +++--- src/lib/components/PaneLayout.svelte | 34 ++++-- src/lib/components/ResizeHandle.svelte | 30 ++++- src/lib/components/StudioShell.svelte | 77 ++++++++----- src/lib/components/TerminalPage.svelte | 154 ++++++++++++++++++++----- src/lib/panel-motion.js | 35 ++++++ src/lib/panel-resize.test.js | 112 ++++++++++++++++++ src/lib/stores/layout.js | 18 ++- 10 files changed, 417 insertions(+), 89 deletions(-) create mode 100644 .changeset/panel-resize-fps.md create mode 100644 src/lib/panel-resize.test.js diff --git a/.changeset/panel-resize-fps.md b/.changeset/panel-resize-fps.md new file mode 100644 index 00000000..9ffe7eae --- /dev/null +++ b/.changeset/panel-resize-fps.md @@ -0,0 +1,3 @@ +### Bug Fixes + +- **Smooth panel resizing** - Dragging the terminal dock, sidebars or a split pane no longer refits the terminal and reallocates the data grid on every frame. The terminal holds its grid during the drag and refits once on release, and window resizes fit once the drag settles. The terminal dock has a proper handle with a wider grab area, and double-clicking it resets the height. diff --git a/src/app.css b/src/app.css index 72a5e2c9..17e5bb49 100644 --- a/src/app.css +++ b/src/app.css @@ -634,9 +634,11 @@ html[data-os="linux"] { --window-radius: 8px; } /* Lock cursor globally while drag is active so it never flickers mid-drag */ body.is-resizing-x, - body.is-resizing-x * { cursor: col-resize !important; } + body.is-resizing-x * { cursor: col-resize !important; user-select: none !important; -webkit-user-select: none !important; } body.is-resizing-y, - body.is-resizing-y * { cursor: row-resize !important; } + body.is-resizing-y * { cursor: row-resize !important; user-select: none !important; -webkit-user-select: none !important; } + /* Skip xterm hit-testing while dragging any panel resize handle */ + html[data-resizing] .xterm { pointer-events: none !important; } /* An open modal dialog locks `pointer-events: none` on (bits-ui), and only the dialog's own content/overlay opt back in. Dialogs that inset diff --git a/src/lib/components/DataTable.svelte b/src/lib/components/DataTable.svelte index c97a4b6f..2de5586d 100644 --- a/src/lib/components/DataTable.svelte +++ b/src/lib/components/DataTable.svelte @@ -1,5 +1,6 @@