mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-30 02:04:32 +01:00
fix(color-ui, ui-panels): clear the three design-lint findings on main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
This commit is contained in:
1 parent
7097741460
commit
960c882d55
2 files changed
+8
-7
No files matched your search
@@ -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::<Option<(f64, u32)>, _>(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::<Option<(f64, u32)>, _>(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::<Option<(f64, u32)>, _>(ctx, first, |last| *last = None);
|
||||
} else {
|
||||
ctx.data_mut(|data| data.insert_temp(first, (start.time, start.clicks)));
|
||||
with_session::<Option<(f64, u32)>, _>(ctx, first, |last| *last = Some((start.time, start.clicks)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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::<Gesture>(sub(cx.core.id, GESTURE)).0;
|
||||
let gesture = &mut cx.core.memory.shown::<WindowMoving>(sub(cx.core.id, GESTURE)).0;
|
||||
if let Some(change) = self.placed {
|
||||
*gesture = change.kind == PlacementKind::Move && matches!(change.phase, GesturePhase::Begin | GesturePhase::Update);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user