fix(dock): size drag preview slots by the edge viewport height

The dock drag preview computed slot heights and drop indices from the full
window height, but docked panel columns only span the model viewport, so the
preview overlay and insertion point drifted below the actual dock edge. Use the
current viewport height so the ghost and drop index line up with the panels.
This commit is contained in:
Karim Jerbi 2026-08-14 20:51:22 +01:00
commit 2a0b7805c0
2 changed files with 4 additions and 2 deletions

View file

@ -636,6 +636,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
}
DockMsg::DragMove(point) => {
if self.dock_dragging.is_some() {
let avail = self.tabs[self.active_tab].scene.selection.borrow().vp_size.1;
let side = if point.x < self.win_size.0 * 0.5 {
DockSide::Left
} else {
@ -644,7 +645,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
let index = crate::ui::dock::drop_index(
point.y,
std::cmp::max(self.dock.len(side), 1),
self.win_size.1,
avail,
);
self.dock_drag_target = Some((side, index));
} else if let Some(id) = self.dock_resizing {

View file

@ -1563,7 +1563,8 @@ impl OpenCADStudio {
} else {
self.dock.len(side) + 1
};
let slot_h = self.win_size.1 / final_count as f32;
let edge_h = tab.scene.selection.borrow().vp_size.1;
let slot_h = edge_h / final_count as f32;
let index = self.dock_drag_target.map(|(_, i)| i).unwrap_or(0);
let slot = index.min(final_count.saturating_sub(1));
let ghost_top = slot as f32 * slot_h;