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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-05 15:03:11 +03:00
1 parent 3bcb5a04c5
commit 0a60b36b66
2 files changed
+42 -1

No files matched your search

+7 -1
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()
};