Color Lookup layer Properties: Dither is a checkbox, as in the reference application (#18364)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-11-30 19:57:11 +01:00
1 parent 7118b4122e
commit 772f58ceec
2 files changed
+7 -5

No files matched your search

+3 -3
View File
@@ -10,7 +10,7 @@ use craft::behavior::EditEvent;
// PLAN: `craft::cms` needs the umbrella's `cms` feature in crates/ui-egui/Cargo.toml (not in this set).
use craft::cms::lutfile::{LutError, LutFile, write_cube};
use craft::color_ui::ui::{LutChoice, LutPicker};
use craft::ui::choice::Switch;
use craft::ui::choice::Checkbox;
use craft::ui::contract::{Bind, Props as _, Show, ShowContainer};
use craft::ui::form::Field;
use photocraft_doc::{Adjustment, LayerId};
@@ -80,7 +80,7 @@ fn apply_loaded(app: &mut PhotocraftApp, layer: LayerId, loaded: Result<LutFile,
}
/// The Color Lookup layer's controls, as the reference application lays them out: the LUT picker in its "3D LUT File"
/// row, then Dither. There is no interpolation choice: a new layer interpolates tetrahedrally, as the dialog does
/// row, then the Dither checkbox. There is no interpolation choice: a new layer interpolates tetrahedrally, as the dialog does
/// (#18364); an agent can still set `interpolation` through `layer.setAdjustment`.
pub fn color_lookup_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj: &Adjustment) {
let Adjustment::ColorLookup { dither, .. } = adj else { return };
@@ -122,7 +122,7 @@ pub fn color_lookup_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: Layer
apply_loaded(app, id, loaded);
}
}
let dithered = Switch::new(Bind::given(*dither)).label(tl!("Dither")).show(ui);
let dithered = Checkbox::new(Bind::given(*dither)).label(tl!("Dither")).show(ui);
if let Some(on) = dithered.events.committed().copied() {
set_adjustment(app, id, json!({"dither": on}));
}
@@ -1,4 +1,4 @@
//! #18364: a Color Lookup layer's Properties show the LUT picker in its "3D LUT File" row and Dither, with no
//! #18364: a Color Lookup layer's Properties show the LUT picker in its "3D LUT File" row and a Dither checkbox, with no
//! interpolation choice, and their Reset returns the layer to a new layer's state.
use egui::vec2;
@@ -51,7 +51,9 @@ fn the_picker_sits_in_a_labelled_row_with_dither_and_no_interpolation_choice() {
let h = harness();
let picker = h.get_by_role(egui::accesskit::Role::ComboBox);
assert_eq!(picker.accesskit_node().label().as_deref(), Some("3D LUT File"));
let dither = h.get_by_label("Dither").rect();
let dither = h.get_by_label("Dither");
assert_eq!(dither.accesskit_node().role(), egui::accesskit::Role::CheckBox, "Dither is a checkbox, as in the reference application");
let dither = dither.rect();
assert!(picker.rect().min.x > dither.min.x + 20.0, "room for the row's label: picker {:?}, Dither {dither:?}", picker.rect());
assert!(picker.rect().max.y <= dither.min.y, "Dither comes after the picker");
for gone in ["Trilinear", "Tetrahedral", "Interpolation"] {