From efebc0cdace53fe5d0cc850bf587f645404bfeda Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 01:08:34 +0700 Subject: [PATCH] color-ui: ColorDisc::stored_as and HarmonyWheel::stored_as take the host's round trip through its own colour model, so a drag whose colour comes back moved by it (CMYK through a profile) is still the drag's; without it the disc keeps its 8-bit echo check: a host storing colours in another model had its own drags cancelled as outside changes --- crates/color-ui/src/ui/disc.rs | 34 +++++++++++++---- crates/color-ui/src/ui/harmony.rs | 15 +++++++- crates/color-ui/tests/it/color_parts.rs | 51 +++++++++++++++++++++---- 3 files changed, 84 insertions(+), 16 deletions(-) diff --git a/crates/color-ui/src/ui/disc.rs b/crates/color-ui/src/ui/disc.rs index 1406565fa9..7f4a4826c3 100644 --- a/crates/color-ui/src/ui/disc.rs +++ b/crates/color-ui/src/ui/disc.rs @@ -41,7 +41,7 @@ const SECTORS: u32 = 24; const PATCH_RINGS: u32 = 5; const SECTOR_DEGREES: f32 = 15.0; /// How far from where a drag put its marker, in radii, the host's colour may lie and still be the drag's: what an -/// 8-bit or another model's round trip moves a colour by, two of the hundredths a drag reports its radial in. +/// 8-bit round trip moves a colour by, two of the hundredths a drag reports its radial in. const ECHO_REACH: f32 = 0.02; craft_ui::words! { @@ -191,7 +191,8 @@ struct Grab { /// ([`pressed`](ColorDiscOutput::pressed) reports it, for the host to select it); a press elsewhere grabs nothing. /// A drag moves the grabbed marker's hue (the pointer's angle, whole degrees) and saturation (its distance over the /// radius, whole percents, at most 1), one gesture; the marker's brightness stays, the host's slider sets it. A -/// click is one `Set`. A colour of the host's that is not what the drag reported cancels the drag. +/// click is one `Set`. A colour of the host's that is not what the drag reported, after the host's own round trip +/// ([`stored_as`](ColorDisc::stored_as)), cancels the drag. /// - Keys: the markers are one Tab stop, which lands on the selected marker (the first without a selection); a press /// that grabs a marker focuses it. Left and Right change the focused marker's hue by 1 degree, Up and Down its /// saturation by 1 percent; Shift steps ten; each key is a `Set`. During a drag keys change nothing. Esc during a @@ -227,6 +228,7 @@ pub struct ColorDisc<'a> { /// The markers' accessible names, in order; a marker without one is "Color N". #[prop(into)] names: Vec