fix(ui): open the OSNAP settings popup near its button, not the corner

The snap popup used a hardcoded 4 px right offset, pinning it to the
window's right edge — but the Osnap button sits well to the left, with up
to ten pills after it (Space, Scale, Units, Transparency, Isolate, …).
Anchor it by the summed width of the pills that follow Osnap, honouring
the user's per-pill visibility. iced gives the view no real layout
metrics, so the pill widths are estimated (icon pills fixed, labelled
pills approximate); the popup now opens by the button instead of the
corner.

Closes #248

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-05 15:03:11 +03:00
commit 0a60b36b66
2 changed files with 42 additions and 1 deletions

View file

@ -1262,7 +1262,13 @@ impl OpenCADStudio {
.height(Fill);
let snap_layer: Element<'_, Message> = if self.snap_popup_open {
crate::ui::popup::snap_popup::snap_popup_overlay(&self.snapper, 4.0)
crate::ui::popup::snap_popup::snap_popup_overlay(
&self.snapper,
crate::ui::statusbar::osnap_popup_right_offset(
&self.statusbar_config,
tab.scene.viewport_count(),
),
)
} else {
iced::widget::Space::new().width(0).height(0).into()
};