From 9b25308edc8365939206fa1e92de4ccc6ddfb0ec Mon Sep 17 00:00:00 2001 From: David Mann Date: Sun, 22 Nov 2026 18:09:43 +0100 Subject: [PATCH] Dock grips: the strip keeps space above and below the marks (photocraft#16426) The grip strip above an icon group and under a tool rail's column bar was the least hit size (8 points), so the 5-point ticks nearly touched its top edge. It is now tall enough for the theme's marks with space.gap.tight above and below them. Co-Authored-By: Claude Opus 5.5 --- crates/ui-panels/src/docking/group.rs | 9 +++++++++ crates/ui-panels/src/docking/iconic.rs | 2 +- crates/ui-panels/src/docking/iconic/trials.rs | 10 ++++++++-- crates/ui-panels/src/docking/targets.rs | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/crates/ui-panels/src/docking/group.rs b/crates/ui-panels/src/docking/group.rs index f2c0abfbf..c27c1d9ae 100644 --- a/crates/ui-panels/src/docking/group.rs +++ b/crates/ui-panels/src/docking/group.rs @@ -71,6 +71,15 @@ impl GripMarks { } } +/// The height of a grip strip (above an icon group, under a tool rail's column bar): at least the least hit size, and +/// tall enough that the theme's marks keep `space.gap.tight` above and below them, so they never touch the strip's +/// edge (photocraft#16426). +pub(crate) fn grip_strip(tokens: &Tokens) -> f32 { + let GripShape { mark, length, width, .. } = tokens.shape.grip; + let marks = if mark == GripMark::Ticks { length } else { width }; + tokens.size.hit.target.max(marks + 2.0 * tokens.space.gap.tight) +} + /// What a group grip reports: its response, the second press of a double click and whether it started a group /// drag this pass. #[derive(Debug)] diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 345786f84..8b5d7d48c 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -62,7 +62,7 @@ impl IconicSizes { IconicSizes { column: DockSizes::style(cx), cell: size.rail.button, - grip: size.hit.target, + grip: super::group::grip_strip(cx.tokens), separator: cx.tokens.space.gap.tight, labels: size.rail.width * LABELS_IN_RAIL_WIDTHS, } diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index cb5d6bd5c..2ab8e9f3b 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -486,14 +486,20 @@ fn a_groups_grip_is_a_row_of_upright_ticks_in_the_grip_ink() { }); fixture.room(SCREEN).settle(); let id = fixture.root_id().expect("the column shows"); - let (panel, grip, shape) = - StyleCx::with_root(fixture.ctx(), |cx| (cx.tokens.color.surface.panel, cx.tokens.color.line.grip, cx.tokens.shape.grip)); + let (panel, grip, shape, tight) = StyleCx::with_root(fixture.ctx(), |cx| { + (cx.tokens.color.surface.panel, cx.tokens.color.line.grip, cx.tokens.shape.grip, cx.tokens.space.gap.tight) + }); assert_eq!(shape, craft_theme::GripShape::DEFAULT, "the fixture's theme sets no grip shape"); for group in [0, 1] { let strip = fixture.part_rect(id, GRIP.at(group)).expect("each group has its grip"); let shapes = fixture.frame_shapes(); let (ticks, ink) = grip_ticks(&shapes, strip).expect("the grip paints its ticks"); assert_grip_ticks(&ticks, ink, strip, panel, grip, shape, &format!("group {group}")); + let run = ticks.iter().fold(Rect::NOTHING, |run, tick| run.union(*tick)); + assert!( + run.top() - strip.top() >= tight - 0.01 && strip.bottom() - run.bottom() >= tight - 0.01, + "group {group}: the marks keep space.gap.tight ({tight}) off the strip's edges: {run:?} in {strip:?}" + ); fixture.frame(vec![egui::Event::PointerMoved(strip.center())]); let hovered = fixture.frame_shapes(); let (_, hover_ink) = grip_ticks(&hovered, strip).expect("the grip paints its ticks under the pointer"); diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index 3c20611ee..21e3d0153 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -82,7 +82,7 @@ pub struct DockSizes { pub rail_step: f32, /// The height of a grip strip, the band with the dock's grip marks: above each icon group of a collapsed column, /// and under the column bar of a tool rail (a group whose panel has a [`DockGrid`](super::DockGrid)) that the host - /// shows itself (the least hit size). + /// shows itself: the least hit size, or the theme's grip marks with `space.gap.tight` above and below them. pub grip: f32, } @@ -128,7 +128,7 @@ impl DockSizes { column: size.dock.column, rail_first: size.rail.button + 2.0 * cx.tokens.space.pad.control, rail_step: size.rail.button + cx.tokens.space.gap.tight, - grip: size.hit.target, + grip: super::group::grip_strip(cx.tokens), } }