From 86ca1b70337cb9e29238904ef61800165ff13dad Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 29 May 2026 10:00:30 +0300 Subject: [PATCH] fix(grip): popup sizes to widest label + full-row highlight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous single-widget refactor left the column at `Length::Shrink` and the buttons at `Length::Fill`, which iced resolves to a zero-width column — the popup degenerated into a 1-pixel vertical line. Set the column to a fixed pixel width derived from the longest item's label (and restore `width(Fill)` on the buttons) so the selection highlight covers the full row instead of just the text glyphs. Also silences a `dead_code` warning on `GripMenuAction` variants that the Phase 2 / 3 wiring will consume next. --- src/app/view.rs | 16 ++++++++++++++-- src/scene/object.rs | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/view.rs b/src/app/view.rs index 60a0a1d57..a8ab45057 100644 --- a/src/app/view.rs +++ b/src/app/view.rs @@ -691,7 +691,20 @@ impl OpenCADStudio { if !tab.is_start { let anchor_x = (popup.anchor.x + 12.0).max(0.0); let anchor_y = (popup.anchor.y + 12.0).max(0.0); - let mut col = column![].spacing(0); + // Size the row to the widest label so the selection + // highlight fills the whole row instead of just the + // text glyphs. ~7 px per character at size 12 + the + // horizontal padding (10 + 10). + let max_len = popup + .items + .iter() + .map(|i| i.label.chars().count()) + .max() + .unwrap_or(8) as f32; + let row_w = max_len * 7.0 + 24.0; + let mut col = column![] + .spacing(0) + .width(iced::Length::Fixed(row_w)); for (idx, item) in popup.items.iter().enumerate() { let is_sel = idx == popup.selected; let label = item.label; @@ -727,7 +740,6 @@ impl OpenCADStudio { } let menu_panel = container(col) .padding(2) - .width(iced::Length::Shrink) .style(|_: &Theme| container::Style { background: Some(Background::Color(Color { r: 0.10, diff --git a/src/scene/object.rs b/src/scene/object.rs index 8f82850f6..658d19dcd 100644 --- a/src/scene/object.rs +++ b/src/scene/object.rs @@ -111,6 +111,7 @@ pub struct GripMenuItem { /// default no-op-equivalent — picking it just starts the regular /// stretch drag, identical to clicking the grip with no popup open. #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[allow(dead_code)] pub enum GripMenuAction { Stretch, Lengthen,