LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1474 (rebased)
Brandon Thomas88ca6ed572cc
diff --cc crates/ui-egui/src/widgets.rsindex 49b34bcb6,870e6b107..a00bca4b2--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@@ -218,14 -218,13 +218,18 @@@ pub(crate) fn shown_value(spec: &Controif shown == "+0" || shown == "-0" { "0".to_string() } else { shown }}+/// Pointer travel (points, sideways from the press) that turns a press on a slider's value into a+/// scrub rather than a click that types a value.+const SCRUB_START: f32 = 3.0;++ /// The radius of a slider's hollow ring thumb.+ const THUMB_RING: f32 = 7.0;+/// A Lightroom slider row (label + value above a track with a hollow ring thumb).- /// Double-click the label or thumb to reset. Shift-drag = fine adjustment. Scroll sideways over- /// it to nudge it. Click the value to type one: Return or clicking away applies it, Esc keeps the- /// old one. Drag the value sideways to scrub it, as if dragging the thumb (Shift: a tenth as far).-/// Double-click the label or thumb to reset (hovering either says so). Shift-drag = fine-/// adjustment. Scroll sideways over it to nudge it. Click the value to type one: Return or clicking away applies it, Esc keeps the-/// old one.++/// Double-click the label or thumb to reset (hovering either says so). Shift-drag = fine adjustment.++/// Scroll sideways over it to nudge it. Click the value to type one: Return or clicking away applies it,++/// Esc keeps the old one. Drag the value sideways to scrub it, as if dragging the thumb (Shift: a tenth++/// as far).pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_override: Option<&str>) -> SliderOut {let t = Tokens::get(ui.ctx());let w = ui.available_width();@@@ -261,17 -260,21 +265,22 @@@node.add_action(egui::accesskit::Action::Decrement);}});- let label_resp = ui.interact(label_rect, id.with("label"), Sense::click());+ // the name: double-click it to reset, as the thumb (a disabled slider's name is only text)+ let label_resp = ui.interact(label_rect, id.with("label"), if enabled { Sense::click() } else { Sense::hover() });+ // say how to reset (issue #1436: the double-click was hard to discover), as the curve channels do+ let reset_hint = crate::i18n::tr_format!("{name} — double-click to reset it", name = label_text);+ let label_resp = if enabled { label_resp.on_hover_text(reset_hint.as_str()) } else { label_resp };crate::widgets::announce(&label_resp, crate::i18n::tr_format!("Reset {name}", name = label_text.clone()));+ register(ui.ctx(), format!("sliderLabel:{}", spec.id), label_rect);register(ui.ctx(), format!("slider:{}", spec.id), track_rect);- // the value: click it to type an exact one (over the label, so it takes the click)+ // the value: click it to type an exact one, drag it sideways to scrub (over the label, so it+ // takes the click)let value_rect = Rect::from_min_max(pos2(label_rect.right() - 64.0, label_rect.top()), label_rect.max);- let value_resp = ui.interact(value_rect, id.with("value"), if enabled { Sense::click() } else { Sense::hover() });- crate::widgets::announce(&value_resp, format!("{label_text}: {}", crate::i18n::tr("Click to type a value")));+ let value_resp = ui.interact(value_rect, id.with("value"), if enabled { Sense::click_and_drag() } else { Sense::hover() });+ crate::widgets::announce(&value_resp, format!("{label_text}: {}", crate::i18n::tr("Click to type a value, drag to change it")));register(ui.ctx(), format!("sliderValue:{}", spec.id), value_rect);// say that an exact value can be typed here (issue #534: an exact crop angle was hard to find)- let value_resp = if enabled { value_resp.on_hover_text(crate::i18n::tr("Click to type a value")) } else { value_resp };+ let value_resp = if enabled { value_resp.on_hover_text(crate::i18n::tr("Click to type a value, drag to change it")) } else { value_resp };let typing_id = id.with("typing");// Keep the short focus-acquisition guard, but let an explicit Return/Escape end the edit.let mut typing: Option<(String, u8, bool)> = ui.data(|m| m.get_temp(typing_id));@@@ -314,29 -294,14 +323,35 @@@// value ↔ track position: linear, except for the Kelvin temperature (`ControlSpec::position`)let to_x = |v: f64| track_rect.left() + spec.position(v) as f32 * track_rect.width();let from_x = |x: f32| spec.value_at(f64::from((x - track_rect.left()) / track_rect.width()));+ // the thumb: a click there doesn't move the value, and resting on it says how to reset (the rest+ // of the track, which is clicked and dragged, gets no tooltip)+ let on_thumb = |p: egui::Pos2| (p.x - to_x(value)).abs() <= THUMB_RING + 1.0;+ if enabled && !resp.dragged() && resp.hover_pos().is_some_and(on_thumb) {+ resp.clone().on_hover_text(reset_hint.as_str());+ }let mut v = value;- if let Some((mut text, frames, pressed)) = typing.take() {+ if let Some(mut pos) = scrub {+ // scrubbing the value moves it as dragging the thumb would: the pointer's sideways travel+ // over the track's width (a tenth with Shift), on the control's steps+ if !scrub_started && value_resp.dragged() {+ let fine = if ui.input(|i| i.modifiers.shift) { 0.1 } else { 1.0 };+ let dx = ui.input(|i| i.pointer.delta().x);+ pos = (pos + f64::from(dx / track_rect.width()) * fine).clamp(0.0, 1.0);+ }+ let step = spec.step.max(1e-9);+ let nv = ((spec.value_at(pos) / step).round() * step).clamp(spec.min, spec.max);+ if (nv - value).abs() > 1e-12 {+ out.value = Some(nv);+ v = nv;+ }+ out.drag_started = scrub_started;+ if value_resp.drag_stopped() {+ out.drag_stopped = true;+ ui.data_mut(|m| m.remove::<f64>(scrub_id));+ } else {+ ui.data_mut(|m| m.insert_temp(scrub_id, pos));+ }+ } else if let Some((mut text, frames, pressed)) = typing.take() {// Keep the owned opening release focused without restarting its draft or selection.// egui gives that release's click to the readout, so the field under it gives up the focus// whatever frame it lands on (issue #1362): the field takes it back after drawing too.@@@ -503,12 -471,11 +521,12 @@@p.text(label_rect.left_center(), Align2::LEFT_CENTER, crate::i18n::tr(label_override.unwrap_or(spec.label)), t.font(12.5), text_c);if typing.is_none() {p.text(label_rect.right_center(), Align2::RIGHT_CENTER, shown_value(spec, v), t.font(12.5), text_c);- if enabled && value_resp.hovered() {- ui.ctx().set_cursor_icon(egui::CursorIcon::Text);+ // the scrub pointer, as over Lightroom's values: a drag here changes the value+ if enabled && (value_resp.hovered() || scrub.is_some()) {+ ui.ctx().set_cursor_icon(egui::CursorIcon::ResizeHorizontal);}}- let ring = 7.0;+ let ring = THUMB_RING;let tx = to_x(v);paint_track(ui, track_rect, &spec.track, &t, tx, ring);let p = ui.painter();diff --cc docs/parity-checklist.mdindex f51b8142b,ff90e3ec3..b8501fe74--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -672,10 -673,9 +672,10 @@@ From `06-shortcuts.md` part 1. Evidenc| KEY-CROP-OVERLAYORIENT | Crop overlay orientation — ⇧O | P1 | ✅ | `cmd:view.cropOverlayOrientation` | while cropping: O cycles the overlay, ⇧O its orientation || KEY-CROP-RESET | Reset crop — ⌥⌘R | P0 | ✅ | `cmd:crop.reset` | || KEY-STRAIGHTEN | Straighten while held — ⌘ drag | P1 | ✅ | `cmd:crop.straighten`, `crates/ui-egui/src/panels/detail.rs` (`straighten_overlay`) | ⌘-drag in Crop draws a level line; the crop tool stays active |- | KEY-SLIDER-RESET | Reset slider — double-click | P0 | ✅ | `crates/ui-egui/src/widgets.rs` | |+ | KEY-SLIDER-RESET | Reset slider — double-click | P0 | ✅ | `crates/ui-egui/src/widgets.rs`, `crates/ui-egui/src/tests_slider_reset.rs` | double-click a slider's name or thumb: back to its default as one undo step (a click on the thumb no longer moves it first, which made it two); resting the pointer on either says so (“Exposure — double-click to reset it”, as the curve channels), the value keeps “Click to type a value” (issue #1436); a disabled slider's name doesn't reset it. No per-slider reset button (Lightroom has none); no ⌥ panel headings turning into Reset buttons yet (`cmd:develop.resetSection` is command-only) || KEY-SLIDER-NUDGE | Nudge slider — ↑/↓ | P1 | ✅ | `crates/ui-egui/src/widgets.rs` (`nudged`), `cmd:develop.adjust` | ↑/↓ over any slider: ≈ 1/200 of its range (exposure 0.05, most sliders 1, temperature 50 K); ⇧ ×5; one undo step each. Scrolling sideways over any slider (trackpad swipe, tilting wheel, ⇧+wheel) nudges it the same way, one wheel notch a step, without selecting it first; only a mostly sideways movement counts, so scrolling the panel leaves sliders alone (`crates/ui-egui/src/tests_masking.rs`, `sideways_scrolling_adjusts_the_slider_under_the_pointer`) || KEY-SLIDER-TYPE | Type a slider value | P1 | ✅ | `crates/ui-egui/src/widgets.rs` (`typed_value`), `crates/ui-egui/src/text_field.rs`, `crates/ui-egui/src/widgets/tests_numeric_entry.rs` (`opening_release_honors_return_and_escape_immediately`), `crates/ui-egui/src/tests_keymap.rs` (`opening_numeric_release_keeps_keys_in_the_editor`) | click the value next to any slider's name and type one (`1.5`, `+0,25`, `-20`, `5600 K`): Return or clicking away applies it on the control's steps and range as one undo step, Esc keeps the old value; issue #322; Return/Escape take effect on the opening release, retaining the stored value on Escape; typing stays in the editor without triggering global shortcuts |+| KEY-SLIDER-SCRUB | Scrub a slider value — drag the number | P1 | ✅ | `crates/ui-egui/src/widgets.rs` (`slider`, `SCRUB_START`), `crates/ui-egui/src/widgets/tests_numeric_entry.rs` (`dragging_the_value_sideways_scrubs_it_like_the_thumb`, `scrubbing_back_and_with_shift`, `a_press_that_barely_moves_still_types`) | drag the value next to any slider's name sideways: it moves as dragging the thumb would (the pointer's travel over the track's width, ⇧ a tenth as far), on the control's steps and range, as one undo step; a press that moves less than 3 points sideways stays a click that types a value (KEY-SLIDER-TYPE); the pointer over the value is the horizontal-resize cursor, as Lightroom's scrubby value || KEY-SHORTCUTS | Shortcut list — ⌘/ | P1 | ✅ | `cmd:app.shortcuts` | || KEY-HELP | Help — F1 | P2 | ✅ | `cmd:app.help` | || KEY-VIDEO-PLAY | Play/pause video — Space | P1 | ⬜ | | |@@@ -825,7 -817,7 +825,8 @@@ Latin stays upright. Advanced Japanese| 2026-10-13 | minor | KEYC-RATING: backtick cycles the flag (`photo.cycleFlag`), ⌘↑ / ⌘↓ raise / lower it (`photo.increaseFlag`, `photo.decreaseFlag`); status unchanged (🟡) || 2026-10-13 | patch | LR-MASK-LUMRANGE / LR-MASK-COLORRANGE: range drags keep the grabbed endpoint; colour samples use the render's enabled sections and HDR/SDR settings; regression coverage, status unchanged || 2026-10-13 | minor | LR-IMP-DEVICE: Settings → Import → Cameras and Cards can open the import review when a camera or card is connected; status unchanged (✅) |+| 2026-10-13 | minor | KEY-SLIDER-SCRUB: drag a slider's value sideways to scrub it, as in Lightroom (new row) |+ | 2026-10-13 | minor | KEY-SLIDER-RESET: hovering a slider's name or thumb says a double-click resets it; a double-click on the thumb is one undo step, not two; a disabled slider's name doesn't reset it (issue #1436); status unchanged (✅) || 2026-10-11 | minor | LR-MERGE-HDR: HDR and panorama merges of raws without colour matrices (CR2, NEF, ARW…) write the colour they open with as DNG tags (issue #965); status unchanged || 2026-10-12 | minor | LR-META-XMP: Read Metadata from File no longer auto-writes the sidecar it has just read, which added `lc:settings` and hid another app's later `crs:` edits (#934); status unchanged (✅) || 2026-10-12 | patch | LR-IMP-CAMERA-COVERAGE: CR2 white level from the active area, not the saturated masked rows above it (issue #1272); status unchanged (🟡) |diff --cc docs/whats-new.mdindex ac84c2d2a,27cf0ed6b..1169bf0d1--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -335,6 -281,14 +335,12 @@@"LightCraft stopped unexpectedly" and why, instead of "could not open its window", and the next start renderson the CPU and explains how to turn the GPU back on.-## 2026-10-13-+ ### Resetting a slider+ - Resting the pointer on a slider's name or its thumb now says that a double-click resets it ("Exposure — double-click+ to reset it"), in every language (issue #1436).+ - A double-click on the thumb is a single step in History and Undo. Its first click no longer nudges the value to+ where the pointer landed, and a single click on the thumb leaves the value alone.+### Slider drags on large raws- Dragging a slider no longer re-renders the edited photo's filmstrip thumbnail on every frame; it follows once youlet go. On a 64 MP raw the first of those renders decoded the whole file again, which held up the loupe's