From a7ad7e078a3e26a1e2646f81f67ea4b4e50d4c53 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sun, 5 Jul 2026 15:09:28 +0300 Subject: [PATCH] fix(ui): anchor the OSNAP popup by its bottom-left corner Position the snap popup so the anchor point (by the Osnap button) is its bottom-LEFT corner, opening up and to the right of the button rather than extending left from its right edge. Pad by the anchor minus the panel width, clamped so a narrow bar can't push it off-screen. Refs #248 Co-Authored-By: Claude Opus 4.8 --- src/ui/popup/snap_popup.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/popup/snap_popup.rs b/src/ui/popup/snap_popup.rs index 4c865829b..0db20ff22 100644 --- a/src/ui/popup/snap_popup.rs +++ b/src/ui/popup/snap_popup.rs @@ -42,6 +42,7 @@ pub fn snap_popup_overlay<'a>(snapper: &'a Snapper, right_offset: f32) -> Elemen let panel_content = column![header, divider, column(rows)]; + const PANEL_W: f32 = 210.0; let panel = container(panel_content) .style(|_: &Theme| container::Style { background: Some(Background::Color(PANEL_BG)), @@ -52,15 +53,20 @@ pub fn snap_popup_overlay<'a>(snapper: &'a Snapper, right_offset: f32) -> Elemen }, ..Default::default() }) - .width(Length::Fixed(210.0)); + .width(Length::Fixed(PANEL_W)); - // ── Position: bottom-right, above the status bar (26 px) ───────────── + // ── Position above the status bar, anchored by its bottom-LEFT corner at + // `right_offset` from the window's right edge (the Osnap button), so it + // opens up and to the right of the button. `align_right` positions by the + // panel's right edge, so pad by the anchor minus the panel width; clamp so + // a narrow bar can't push it off-screen. (#248) + let right = (right_offset - PANEL_W).max(4.0); let positioned = container(panel) .align_right(Fill) .align_bottom(Fill) .padding(Padding { bottom: 27.0, - right: right_offset, + right, top: 0.0, left: 0.0, })