diff --git a/crates/color-ui/src/ui/picker/channel.rs b/crates/color-ui/src/ui/picker/channel.rs index 2e3b4aef14..b7494091ee 100644 --- a/crates/color-ui/src/ui/picker/channel.rs +++ b/crates/color-ui/src/ui/picker/channel.rs @@ -14,7 +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::memory::sub; use craft_ui::runtime::pointer; use craft_ui::style::{ComponentStyle, DataColor, StyleColor, StyleCx}; use craft_ui::value_drag::{SliderThumb, TrackFace}; @@ -350,23 +350,22 @@ impl Component for UnitsCell { } fn update(&mut self, cx: &mut Cx<'_, Self>) { - let first = cx.id.with("units-first-click"); - let ctx = &cx.response.ctx; + let first = sub(cx.core.id, "units-first-click"); // 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)) { - with_session::, _>(ctx, first, |last| *last = None); + if pointer::frame(&cx.response.ctx).press.is_some_and(|press| !cx.response.rect.contains(press.origin)) { + *cx.core.memory.shown::>(first) = 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 = with_session::, _>(ctx, first, |last| *last); + let earlier = *cx.core.memory.shown::>(first); 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; - with_session::, _>(ctx, first, |last| *last = None); + *cx.core.memory.shown::>(first) = None; } else { - with_session::, _>(ctx, first, |last| *last = Some((start.time, start.clicks))); + *cx.core.memory.shown::>(first) = Some((start.time, start.clicks)); } }