Point at something grey and let the pipeline work out the rest
FR-DEV-3 has asked for "white balance (temperature/tint, and picker)" since it was written, and only the first half existed. `WidgetKind::WhitePoint` was in the vocabulary and `develop::supported` answered false for it, so the node degraded to two sliders — correct behaviour that had quietly become the only behaviour. Sampling a neutral is the first move of the global tonal pass and every colour judgement afterwards is measured against where the grey was put, so guessing at two sliders until a wall stops looking green is the wrong way round. The awkward part is that a picker genuinely needs to know how far a hundred units of temperature move red against blue, and that number is declared in the node's own file. So the inversion lives in `dr_pipeline::neutral` rather than in the interface: the canvas hands over a colour, the core finds the operation that asked to be driven by a pixel and bisects its declared response until the sample comes back grey. Nothing in `ui/` names white balance, and nothing holds a second copy of a response that would be wrong the first time somebody adjusted the range. A bisection rather than a closed-form inverse because only monotonicity is part of the bargain — the expression is free to become a table tomorrow. The result is rounded to the precision the control is drawn at, which is not cosmetic: unrounded, sampling something already neutral lands a ten-thousandth off zero, and the photograph comes back modified with an undo step for a correction of nothing. On the panel side this needed one distinction the generated path was missing. `is_on_canvas` was being read as "and so the panel draws nothing for it", which is right for a crop — four edge fractions are not controls anyone drags in a list — and wrong for an eyedropper, which *writes* temperature and tint and leaves them exactly the controls a photographer reaches for next. So a sampling widget keeps its sliders and puts the affordance that arms the canvas in the group's heading, built like the reset beside it. One click, one sample, one history step: `Edit::Action` never coalesces, and there is no hover preview to fill the stack with temperatures nobody chose. Declaring the presentation also groups temperature and tint under one undo step, where they were two. That follows from what `Presentation` means and reads correctly — white balance is one decision — but it is a change, and worth saying so.
This commit is contained in:
@@ -42,6 +42,17 @@ export struct ParamRow {
|
||||
// cannot see the others.
|
||||
group-modified: bool,
|
||||
|
||||
// TRACES: FR-DEV-3
|
||||
// This operation is driven by pointing at the photograph as well as by
|
||||
// its sliders, so the group's heading carries the control that arms the
|
||||
// canvas. Identical on every row of the group, for the reason
|
||||
// `group-modified` above is: the heading is one of those rows.
|
||||
//
|
||||
// Set in Rust from the widget the operation asked for, never from which
|
||||
// operation it is (ARCH §4.3a) — the panel still does not know that white
|
||||
// balance exists, only that something here can be sampled.
|
||||
group-samples: bool,
|
||||
|
||||
// Which control to build. Mirrors ParamKind, plus the widget kinds an
|
||||
// operation can request through its presentation.
|
||||
kind: string, // "scalar" | "bool" | "enum" | "curve"
|
||||
@@ -111,8 +122,15 @@ component GroupHeading inherits Rectangle {
|
||||
in property <bool> modified: false;
|
||||
/// Whether this group has anything to reset.
|
||||
in property <bool> has-reset: true;
|
||||
/// TRACES: FR-DEV-3
|
||||
/// Whether this group can be set by pointing at the photograph.
|
||||
in property <bool> has-sampler: false;
|
||||
/// Whether the canvas is currently waiting for that point.
|
||||
in property <bool> sampling: false;
|
||||
|
||||
callback reset();
|
||||
/// Arm the sampler, or put it away if it is already armed.
|
||||
callback sample();
|
||||
|
||||
height: Theme.control-height;
|
||||
|
||||
@@ -136,6 +154,52 @@ component GroupHeading inherits Rectangle {
|
||||
visible: root.modified;
|
||||
}
|
||||
|
||||
// TRACES: FR-DEV-3 | NFR-A11Y-2
|
||||
// The eyedropper, built exactly as the reset beside it is: a word, a
|
||||
// hit target grown to a thumb, and a role so it is announced as
|
||||
// something that can be pressed rather than read as a caption.
|
||||
//
|
||||
// A word rather than a drawn pipette, because this heading has no
|
||||
// icons in it and one would be the only glyph in a column of text —
|
||||
// and because "pick" says what happens next, which a pipette only
|
||||
// says to somebody who already knows.
|
||||
//
|
||||
// It stays lit while armed. Arming changes what a click on the
|
||||
// photograph *does*, and a mode with nothing saying it is on is the
|
||||
// fault the develop view's own mode strip exists to prevent.
|
||||
Rectangle {
|
||||
width: 30px;
|
||||
visible: root.has-sampler;
|
||||
|
||||
accessible-role: button;
|
||||
accessible-label: "Set from a neutral in the photograph";
|
||||
accessible-enabled: root.has-sampler;
|
||||
accessible-checkable: true;
|
||||
accessible-checked: root.sampling;
|
||||
accessible-action-default => {
|
||||
if (root.has-sampler) {
|
||||
root.sample();
|
||||
}
|
||||
}
|
||||
|
||||
sample-touch := TouchArea {
|
||||
width: 100%;
|
||||
height: max(parent.height, Theme.touch-target);
|
||||
y: (parent.height - self.height) / 2;
|
||||
enabled: root.has-sampler;
|
||||
mouse-cursor: pointer;
|
||||
clicked => { root.sample(); }
|
||||
}
|
||||
|
||||
Caption {
|
||||
text: "pick";
|
||||
emphasised: root.sampling || sample-touch.has-hover;
|
||||
horizontal-alignment: right;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 34px;
|
||||
visible: root.has-reset;
|
||||
@@ -993,6 +1057,19 @@ export component AdjustPanel inherits Rectangle {
|
||||
callback op-reset(int);
|
||||
callback reset-all();
|
||||
|
||||
// TRACES: FR-DEV-3
|
||||
// The on-canvas sampler: which group has armed it, and the request to arm
|
||||
// one.
|
||||
//
|
||||
// The op index rather than a bool, because arming is a question about a
|
||||
// *group* — two operations could ask for a sampler and only one of them
|
||||
// can be waiting for the click. -1 is none armed, the sentinel this file
|
||||
// already uses for "no swatch" and "everything" and for the same reason:
|
||||
// a Slint struct or property cannot carry an optional.
|
||||
in property <int> sampling-op: -1;
|
||||
/// The heading's picker was pressed, for the operation at this index.
|
||||
callback sampler-armed(int);
|
||||
|
||||
// TRACES: FR-DEV-3f
|
||||
// The film stock, which is not a parameter and so is not a `ParamRow`.
|
||||
//
|
||||
@@ -1276,6 +1353,15 @@ export component AdjustPanel inherits Rectangle {
|
||||
GroupHeading {
|
||||
title: row.op-label;
|
||||
modified: row.group-modified;
|
||||
// TRACES: FR-DEV-3
|
||||
// And, where the operation asked for one, the
|
||||
// control that arms the canvas. The heading knows
|
||||
// only that it has a sampler; which group is
|
||||
// waiting is the panel's business, because only
|
||||
// the panel can see the others.
|
||||
has-sampler: row.group-samples;
|
||||
sampling: root.sampling-op == row.op-index;
|
||||
sample => { root.sampler-armed(row.op-index); }
|
||||
// Resetting is what *this* panel's groups do; the
|
||||
// heading itself has no opinion about it.
|
||||
reset => { root.op-reset(row.op-index); }
|
||||
|
||||
Reference in New Issue
Block a user