Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge upstream/main (fd28da56) into Smart Filters editors

abc2cbb90ddb338ac1
diff --cc crates/ui-egui/src/adjust_dialog.rs
index ea940581d,be9acde2e..231534c31
--- a/crates/ui-egui/src/adjust_dialog.rs
+++ b/crates/ui-egui/src/adjust_dialog.rs
@@@ -193,15 -208,21 +208,26 @@@ pub fn body(app: &mut PhotocraftApp, ui
ui.add_space(4.0);
}
let mut values = crate::filter_dialog::params_of(fields);
- let active = app.session.active().and_then(|s| s.active_layer);
+ let active = fields
+ .get("__smartFilter")
+ .and_then(|f| f.get("layer"))
+ .and_then(Value::as_u64)
+ .map(photocraft_doc::LayerId)
+ .or_else(|| app.session.active().and_then(|s| s.active_layer));
- let gray = app.session.active().is_some_and(|s| adjust_editors::is_gray(s.doc.mode));
+ let isolated_curve = isolated(app);
+ // Only Curves gets an isolated single-channel target here; Levels keeps its usual fields.
+ let gray_plane = (kind == "curves").then(|| isolated_curve.as_ref().and_then(|c| c.gray)).flatten();
+ let gray = gray_plane.is_some() || app.session.active().is_some_and(|s| adjust_editors::is_gray(s.doc.mode));
let hist = match active {
- Some(id) if adjust_editors::needs_histogram(&kind) => Some(tone::histograms(app, HistSource::Layer(id), adjust_editors::space_of(&values))),
+ Some(id) if adjust_editors::needs_histogram(&kind) => {
+ // A mask or saved channel's curve edits that plane's own levels: the histogram
+ // describes it, not the colour layers beneath (#5335).
+ let source = match gray_plane {
+ Some(surface) => HistSource::Channel { layer: id, surface },
+ None => HistSource::Layer(id),
+ };
+ Some(tone::histograms(app, source, adjust_editors::space_of(&values)))
+ }
_ => None,
};
let cx = EditorCx {