mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 16:59:43 +01:00
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.
This commit is contained in:
2 files changed
+10
-1
No files matched your search
@@ -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() }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user