layout: skip notify when resize is clamped

This commit is contained in:
2026-11-11 18:35:23 +07:00
parent 4469a4c280
commit 3296a4c38a
+10 -4
View File
@@ -77,7 +77,8 @@ impl ResizableState {
let pane_count = mins.len(); 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); size = size.max(floor);
if let Some(extent) = self.measured { if let Some(extent) = self.measured {
@@ -90,15 +91,20 @@ impl ResizableState {
size = size.min(ceiling); size = size.min(ceiling);
} }
// Earlier panes hold the equal split they already render at, so the // Earlier panes hold the equal split they already render at,
// first drag does not snap them to a backfilled default. // so the first drag does not snap them to a backfilled default.
let backfill = self.equal_split(pane_count); let backfill = self.equal_split(pane_count);
while self.sizes.len() <= ix { while self.sizes.len() <= ix {
self.sizes.push(backfill); self.sizes.push(backfill);
} }
self.sizes[ix] = size; 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. /// Restores pane `ix` to the equal split, as a double-click does.