PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Options bar: Show Transform Controls in every theme (#5740) (#5802)
Valentin Klein2fbd171427b2
diff --git a/crates/ui-egui/src/move_auto_select_tests.rs b/crates/ui-egui/src/move_auto_select_tests.rsindex 0f01222a5..3d635922e 100644--- a/crates/ui-egui/src/move_auto_select_tests.rs+++ b/crates/ui-egui/src/move_auto_select_tests.rs@@ -152,6 +152,32 @@ fn every_theme_shows_the_auto_select_toggle() {}}+#[test]+fn every_theme_shows_the_transform_controls_toggle() {+ // #5740: outside the Pro themes the Move tool's options bar had no Show Transform Controls, so+ // a click on a layer never showed its box and handles there.+ use egui_kittest::Harness;+ use egui_kittest::kittest::Queryable;+ for theme in crate::theme::ThemeKind::ALL {+ let (app, _, _) = app();+ let mut h = Harness::builder().with_size(egui::vec2(1400.0, 60.0)).build_ui_state(+ |ui, app: &mut PhotocraftApp| {+ if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {+ return;+ }+ crate::panels::options_bar(app, ui);+ },+ app,+ );+ PhotocraftApp::setup_context(&h.ctx, theme);+ h.run_steps(4);+ let before = h.state().ui.tool_options.move_show_transform;+ h.get_by_label("Show Transform Controls").click();+ h.run_steps(2);+ assert_ne!(h.state().ui.tool_options.move_show_transform, before, "{theme:?}: the toggle flips Show Transform Controls");+ }+}+#[test]fn every_theme_shows_the_type_options() {// #1387: outside the Pro themes the Type tool's options bar was only the hint "Click to adddiff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rsindex 769f5a8b9..d8b8e93cf 100644--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@ -1391,6 +1391,9 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {Tool::Move => {// The Studio themes keep Photoshop's Auto-Select toggle too (#1275).widgets::checkbox(ui, &mut app.ui.tool_options.move_auto_select, tl!("Auto-Select:"));+ // And Show Transform Controls (#5740): without it the box could not be+ // turned on outside the Pro themes.+ widgets::checkbox(ui, &mut app.ui.tool_options.move_show_transform, tl!("Show Transform Controls"));hint(ui, tl!("Drag to move the active layer"));}Tool::Eyedropper => crate::eyedropper_ui::options(app, ui),