Show the colour mixer as three runs of twelve, each row a colour
Build and test / Desktop (Linux) (push) Successful in 17m20s
Build and test / Layer separation (push) Successful in 33s
🐳 Android image / Build and push (push) Successful in 2s
Build and test / android-image (push) Successful in 2s
Traceability / Requirement traces (push) Failing after 26s
Build and test / Android (aarch64) (push) Failing after 8m59s
Build and test / Desktop (Linux) (push) Successful in 17m20s
Build and test / Layer separation (push) Successful in 33s
🐳 Android image / Build and push (push) Successful in 2s
Build and test / android-image (push) Successful in 2s
Traceability / Requirement traces (push) Failing after 26s
Build and test / Android (aarch64) (push) Failing after 8m59s
The mixer was thirty-six sliders reading "Hue / Sat / Lum" twelve times over with nothing saying which band any row belonged to. The identity was there all along — the descriptor declares param.mixer.orange.sat and BANDS carries orange at 30° — and was discarded on the way out: labels.rs had no mixer entries, so every key fell through to a derived label that yields the bare channel name. A parameter can now say which aspect it adjusts and which subject it adjusts it on, with the subject's hue where the subject is a colour (descriptor::Facet). That is data about what the operation does, not a layout: the mixer genuinely weights pixels around 30°. What to draw from 30°, and in what order to stack the runs, stay in dr-ui (ARCH §4.3a) — develop.rs brings rows sharing an aspect together and marks the first of each, and adjust.slint names the run once and draws a swatch, a track and a readout on one line. Grouped by channel rather than by band because an edit is almost never "everything about orange"; it is the saturation of the greens, made by comparing one channel across neighbouring bands. Twelve band sections put those twelve rows in twelve different places. The swatch is the label, which is what makes twelve rows fit where four did. The band name is not lost: it is the row's accessible label, so the control is not colour-only, and labels.rs is where the mapping is written down — including chartreuse as "Yellow-Green" and spring as "Blue-Green", since nobody hunting foliage scans a list for "Spring". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,39 @@ pub struct Presentation {
|
||||
pub params: &'static [ParamId],
|
||||
}
|
||||
|
||||
/// TRACES: FR-DEV-3a
|
||||
/// A parameter's place in an operation whose parameters form a grid.
|
||||
///
|
||||
/// Most operations are a short list of unrelated controls. A few are the
|
||||
/// *same* control applied to a series of subjects: the colour mixer is twelve
|
||||
/// hue bands times hue, saturation and luminance, and rendered as a flat list
|
||||
/// of thirty-six it says none of that — the panel showed "Hue / Sat / Lum"
|
||||
/// twelve times over with nothing naming the band.
|
||||
///
|
||||
/// So a parameter may say which **aspect** it adjusts and which **subject** it
|
||||
/// adjusts it on. A UI is free to ignore both and render a flat list; nothing
|
||||
/// becomes unreachable, it merely reads as thirty-six anonymous sliders again.
|
||||
///
|
||||
/// **Why this is not the core deciding presentation** (ARCH §4.3a). Which
|
||||
/// band a parameter belongs to, and that its centre is at 30°, are facts about
|
||||
/// what the operation *does* — the mixer genuinely weights pixels around 30°,
|
||||
/// and that number is the one it weights around. What colour to draw from it,
|
||||
/// at what saturation, whether to draw anything at all, and in what order to
|
||||
/// stack the runs are all presentation, and stay in `dr-ui`. The line: a hue
|
||||
/// in degrees is data; a hex colour in a descriptor would be the core choosing
|
||||
/// appearance, and is forbidden.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Facet {
|
||||
/// What this parameter adjusts. Parameters sharing an aspect are one
|
||||
/// control applied to different subjects.
|
||||
pub aspect: LocalizedKey,
|
||||
/// What it adjusts it on.
|
||||
pub subject: LocalizedKey,
|
||||
/// Where the subject sits on the hue wheel, in degrees, where the subject
|
||||
/// is a colour. `None` for one that is not.
|
||||
pub subject_hue: Option<f32>,
|
||||
}
|
||||
|
||||
/// One parameter of an operation.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ParamDescriptor {
|
||||
@@ -120,6 +153,10 @@ pub struct ParamDescriptor {
|
||||
pub label: LocalizedKey,
|
||||
pub kind: ParamKind,
|
||||
pub default: f32,
|
||||
/// Where this parameter sits among its siblings, for an operation whose
|
||||
/// parameters form a grid. `None` — the usual case — is a parameter that
|
||||
/// stands on its own.
|
||||
pub facet: Option<Facet>,
|
||||
}
|
||||
|
||||
impl ParamDescriptor {
|
||||
@@ -136,6 +173,7 @@ impl ParamDescriptor {
|
||||
precision: 2,
|
||||
},
|
||||
default: 0.0,
|
||||
facet: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +191,7 @@ impl ParamDescriptor {
|
||||
precision: 0,
|
||||
},
|
||||
default: 0.0,
|
||||
facet: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +202,7 @@ impl ParamDescriptor {
|
||||
label: LocalizedKey(label),
|
||||
kind: ParamKind::Bool,
|
||||
default: 0.0,
|
||||
facet: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,15 +224,19 @@ impl ParamDescriptor {
|
||||
precision: 4,
|
||||
},
|
||||
default,
|
||||
facet: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// A general scalar with an explicit range and default.
|
||||
//
|
||||
// Eight arguments, and a builder would be the usual answer — but this has
|
||||
// to be `const` so descriptors can be `static`, and `const` functions
|
||||
// cannot use a builder's method chain. The two common shapes have their
|
||||
// own constructors above; this is the escape hatch for the rest.
|
||||
// to be `const` so descriptors can be `static`, which rules out the
|
||||
// `&mut self` builder the pattern usually takes. (A `self`-by-value step
|
||||
// *is* const-callable — `faceted` below is one — but eight of them would
|
||||
// be eight methods to say what one call already says.) The two common
|
||||
// shapes have their own constructors above; this is the escape hatch for
|
||||
// the rest.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub const fn scalar(
|
||||
id: &'static str,
|
||||
@@ -215,9 +259,23 @@ impl ParamDescriptor {
|
||||
precision,
|
||||
},
|
||||
default,
|
||||
facet: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The same parameter, placed in its operation's grid.
|
||||
///
|
||||
/// A method rather than a sixth constructor, because a facet is orthogonal
|
||||
/// to the shape of the value: a faceted parameter is still an amount, or
|
||||
/// still a scalar in stops, and pairing every constructor with a faceted
|
||||
/// twin would double the list above to say one thing. Taking `self` by
|
||||
/// value is what keeps it usable in the `static` descriptors — a `&mut
|
||||
/// self` builder is what cannot be `const`.
|
||||
pub const fn faceted(mut self, facet: Facet) -> Self {
|
||||
self.facet = Some(facet);
|
||||
self
|
||||
}
|
||||
|
||||
/// Clamp a value into this parameter's declared range.
|
||||
///
|
||||
/// Applied before the value reaches a shader: a slider dragged past its
|
||||
@@ -280,6 +338,28 @@ mod tests {
|
||||
assert_eq!(P.clamp(f32::INFINITY), P.default);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_parameter_stands_alone_unless_it_says_otherwise() {
|
||||
// The default has to be "no grid": every operation but the mixer is a
|
||||
// short list of unrelated controls, and one that accidentally claimed
|
||||
// a facet would have its panel section split under a heading it never
|
||||
// asked for.
|
||||
assert!(P.facet.is_none());
|
||||
assert!(ParamDescriptor::switch("s", "s").facet.is_none());
|
||||
|
||||
let faceted = P.faceted(Facet {
|
||||
aspect: LocalizedKey("param.channel.sat"),
|
||||
subject: LocalizedKey("band.orange"),
|
||||
subject_hue: Some(30.0),
|
||||
});
|
||||
// Placing a parameter in a grid must not change what the parameter
|
||||
// *is* — the value it carries, its range and its default are the same
|
||||
// either way.
|
||||
assert_eq!(faceted.kind, P.kind);
|
||||
assert_eq!(faceted.default, P.default);
|
||||
assert_eq!(faceted.facet.unwrap().subject_hue, Some(30.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amount_controls_are_neutral_at_zero() {
|
||||
// Double-tap-to-reset and "is this op doing anything" both depend on
|
||||
|
||||
Reference in New Issue
Block a user