fix(dock): size drag preview by visible panels, not stack size

The drag preview divided the edge height by the raw panel count on the target
side. Closed panels keep their stack slot, so a hidden panel (e.g. the block
palette tucked away while Properties stays open) split the ghost and the drop
index as if it were rendering — leaving a half-height preview on that edge.
Size slots from the panels actually rendered on the edge instead, via a shared
visibility helper used by both the drop-index math and the ghost/edge-tint
geometry.
This commit is contained in:
Karim Jerbi committed 2026-08-14 22:24:57 +01:00
1 parent 2a0b7805c0
commit df940ad58e
3 files changed
+127 -21

No files matched your search

-12
View File
@@ -195,11 +195,6 @@ impl DockState {
stack.insert(index, id);
true
}
/// Number of panels currently docked on `side`.
pub fn len(&self, side: DockSide) -> usize {
self.stack(side).len()
}
}
/// Insertion index (0..=total) for dropping a panel whose pointer is at
@@ -319,11 +314,4 @@ mod tests {
assert_eq!(drop_index(10.0, 2, 900.0), 0);
assert_eq!(drop_index(890.0, 2, 900.0), 2);
}
#[test]
fn len_reports_stack_size() {
let state = DockState::default();
assert_eq!(state.len(DockSide::Left), 1);
assert_eq!(state.len(DockSide::Right), 1);
}
}