From 83d84dedcac210aed3d0e794b93f315812b2156e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 19 Nov 2026 17:13:57 -0800 Subject: [PATCH] Color Wheel: the checked Harmony Rule item runs no command Clicking the rule that is already set ran ui.colorWheel and counted as a command. It now does nothing, as the checked view and channel items do. --- crates/ui-egui/src/panels/color_wheel.rs | 2 +- crates/ui-egui/src/panels/tests_color_wheel_harmony.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 0e3df51203..c34946387c 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -338,7 +338,7 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { ui.add_enabled_ui(set.view == View::Wheel, |ui| { ui.menu_button(format!(" {}", tl!("Harmony Rule")), |ui| { for rule in harmony_rules() { - if menu_item(ui, rule.label(), true, rule == set.harmony_rule) { + if menu_item(ui, rule.label(), true, rule == set.harmony_rule) && rule != set.harmony_rule { run(app, json!({ "harmonyRule": rule.id() })); } } diff --git a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs index 454e43ec49..f7ce477b98 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs @@ -344,6 +344,15 @@ fn the_panel_menu_shows_the_harmony_and_picks_the_rule() { h.get_by_label(" Pentagram").click(); h.run_steps(2); assert_eq!(h.state().ui.color_wheel.harmony_rule, Harmony::Pentagram); + // The checked rule runs no command. + if h.query_by_label("✓ Pentagram").is_none() { + h.get_by_label(" Harmony Rule").click(); + h.run_steps(2); + } + let commands = h.state().run_count; + h.get_by_label("✓ Pentagram").click(); + h.run_steps(2); + assert_eq!(h.state().run_count, commands, "the checked rule runs no command"); h.state_mut().run("ui.colorWheel", json!({"view": "box"})).unwrap(); h.run_steps(2); assert!(h.get_by_label("✓ Show Harmony").accesskit_node().data().is_disabled(), "gray while the box shows");