Hang the auto-crop off the slider's commit, not off the pointer passing over
The straighten auto-crop worked once and then stopped. It was keyed on `PlainSlider::drag-changed`, whose name is a lie inherited from what it forwards: `SliderTrack` defines `engaged` as `has-hover || claimed`, and it has to — a `Flickable` withholds the press for 100ms, so hover is the only signal that arrives in time to stand the scrolling ancestor down. That is the right definition for the job it was written for and the wrong one for this. Keyed on hover, the correction fires when the pointer first crosses the track — before anything has been dragged — and then does not fire again for as long as the pointer stays on it, however many times the angle is changed. Which is exactly what "it only works once" looks like. `SliderTrack` already publishes the signal this wants. `committed` fires on release, once per gesture, after the final `changed`, and its doc comment says so in as many words. It was simply not forwarded through `PlainSlider`, so it now is, and the geometry panel's callback is a `committed(float)` rather than a `drag-changed(bool)`. The angle needs no re-applying here: the track emits its last `changed` before it commits, so the value is already in the graph by the time this runs. What is left is the correction that has to happen exactly once. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,12 +162,12 @@ export component AppWindow inherits Window {
|
||||
callback flip-v-toggled();
|
||||
callback straighten-changed(float);
|
||||
/// TRACES: FR-DEV-3
|
||||
/// The straightening gesture began (`true`) or ended (`false`).
|
||||
/// The straightening gesture is over and this is the angle to keep.
|
||||
///
|
||||
/// Reported separately from the value because the auto-crop that follows a
|
||||
/// straighten has to happen once, at the end — see
|
||||
/// `DevelopSession::auto_crop_to_angle`.
|
||||
callback straighten-drag-changed(bool);
|
||||
callback straighten-committed(float);
|
||||
/// Crop, angle, rotation and flips back to neutral, leaving colour alone.
|
||||
callback framing-reset();
|
||||
|
||||
@@ -2179,8 +2179,8 @@ in property <bool> panel-visible: true;
|
||||
flip-h-toggled => { root.flip-h-toggled(); }
|
||||
flip-v-toggled => { root.flip-v-toggled(); }
|
||||
angle-changed(v) => { root.straighten-changed(v); }
|
||||
angle-drag-changed(on) => {
|
||||
root.straighten-drag-changed(on);
|
||||
angle-committed(v) => {
|
||||
root.straighten-committed(v);
|
||||
}
|
||||
angle-reset => { root.straighten-changed(0); }
|
||||
reset => { root.framing-reset(); }
|
||||
|
||||
Reference in New Issue
Block a user