From 3296a4c38a5140692f1416c58a1a2a61bc589db9 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Wed, 11 Nov 2026 18:35:23 +0700 Subject: [PATCH] layout: skip notify when resize is clamped --- crates/layout/src/resizable.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/layout/src/resizable.rs b/crates/layout/src/resizable.rs index 8cda21f..1c8f19a 100644 --- a/crates/layout/src/resizable.rs +++ b/crates/layout/src/resizable.rs @@ -77,7 +77,8 @@ impl ResizableState { let pane_count = mins.len(); - let mut size = self.pane_size(ix, pane_count) + delta; + let previous = self.pane_size(ix, pane_count); + let mut size = previous + delta; size = size.max(floor); if let Some(extent) = self.measured { @@ -90,15 +91,20 @@ impl ResizableState { size = size.min(ceiling); } - // Earlier panes hold the equal split they already render at, so the - // first drag does not snap them to a backfilled default. + // Earlier panes hold the equal split they already render at, + // so the first drag does not snap them to a backfilled default. let backfill = self.equal_split(pane_count); while self.sizes.len() <= ix { self.sizes.push(backfill); } self.sizes[ix] = size; - cx.notify(); + + // A drag clamped at its floor or ceiling lands here on every mouse move, + // only a change to the rendered size is worth a frame. + if size != previous { + cx.notify(); + } } /// Restores pane `ix` to the equal split, as a double-click does.