From 960c882d55cd58e014a654648b510fb3cef2bb89 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Sat, 28 Nov 2026 22:45:25 +0000 Subject: [PATCH] fix(color-ui, ui-panels): clear the three design-lint findings on main Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx --- crates/color-ui/src/ui/picker/channel.rs | 9 +++++---- crates/ui-panels/src/docking/floating.rs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/color-ui/src/ui/picker/channel.rs b/crates/color-ui/src/ui/picker/channel.rs index ccd97daa06..2e3b4aef14 100644 --- a/crates/color-ui/src/ui/picker/channel.rs +++ b/crates/color-ui/src/ui/picker/channel.rs @@ -14,6 +14,7 @@ use craft_ui::form::{Field, SliderField, SliderFieldLayout}; use craft_ui::layout_components::Row; use craft_ui::primitives::{PaintShape, StrokeWidth}; use craft_ui::runtime::env::{Label, UnitKind}; +use craft_ui::runtime::memory::with_session; use craft_ui::runtime::pointer; use craft_ui::style::{ComponentStyle, DataColor, StyleColor, StyleCx}; use craft_ui::value_drag::{SliderThumb, TrackFace}; @@ -354,18 +355,18 @@ impl Component for UnitsCell { // A press off the cell ends the cell's click run, even when it starts a new count that the next click on the // cell continues. if pointer::frame(ctx).press.is_some_and(|press| !cx.response.rect.contains(press.origin)) { - ctx.data_mut(|data| data.remove::<(f64, u32)>(first)); + with_session::, _>(ctx, first, |last| *last = None); } let PressPhase::Release { start, click: true, .. } = cx.part(UNITS).press.phase else { return }; // The click count also counts a press just beside the cell, on the number field, so a click is the second of a // double click only when the click just before it, by the count, was a click on this cell. - let earlier = ctx.data(|data| data.get_temp::<(f64, u32)>(first)); + let earlier = with_session::, _>(ctx, first, |last| *last); let follows = earlier.is_some_and(|(time, clicks)| start.clicks == clicks + 1 && start.time - time <= MULTI_CLICK_TIME); if start.clicks >= 2 && follows { self.double_clicked = true; - ctx.data_mut(|data| data.remove::<(f64, u32)>(first)); + with_session::, _>(ctx, first, |last| *last = None); } else { - ctx.data_mut(|data| data.insert_temp(first, (start.time, start.clicks))); + with_session::, _>(ctx, first, |last| *last = Some((start.time, start.clicks))); } } diff --git a/crates/ui-panels/src/docking/floating.rs b/crates/ui-panels/src/docking/floating.rs index 81f1aafbb9..762ab48bab 100644 --- a/crates/ui-panels/src/docking/floating.rs +++ b/crates/ui-panels/src/docking/floating.rs @@ -222,9 +222,9 @@ pub struct FloatingGroupOutput { /// Whether a move of the group's window is running: set by its `Begin` and `Update` steps, cleared by its `Commit` /// or `Cancel` and by any step of a resize. #[derive(Clone, Copy, Default)] -struct Gesture(bool); +struct WindowMoving(bool); -/// The memory slot of [`Gesture`] under the group's id. +/// The memory slot of [`WindowMoving`] under the group's id. const GESTURE: &str = "window_gesture"; impl Outcome for FloatingGroupOutput { @@ -631,7 +631,7 @@ impl Component for FloatingGroup<'_> { // A dock window's band double click collapses or expands its column, as a dock column's bar does. let collapsed = self.column.map(|column| column.collapsed.is_some()); let iconic = collapsed.filter(|_| self.chevron || self.toggled).map(|collapsed| !collapsed); - let gesture = &mut cx.core.memory.shown::(sub(cx.core.id, GESTURE)).0; + let gesture = &mut cx.core.memory.shown::(sub(cx.core.id, GESTURE)).0; if let Some(change) = self.placed { *gesture = change.kind == PlacementKind::Move && matches!(change.phase, GesturePhase::Begin | GesturePhase::Update); }