diff --git a/crates/ui-egui/src/canvas/cursor_policy.rs b/crates/ui-egui/src/canvas/cursor_policy.rs index 8035e70b49..63c9a9ca44 100644 --- a/crates/ui-egui/src/canvas/cursor_policy.rs +++ b/crates/ui-egui/src/canvas/cursor_policy.rs @@ -73,8 +73,9 @@ pub(crate) fn click_tool_cursor(tool: Tool, precise: bool) -> Option { /// Object Selection's pointer (#12865): a crosshair centred on the hotspot with a small dotted /// rectangle at its lower right, the same with ⇧, ⌥ or ⇧⌥ held (the keys still add, subtract and /// intersect, but draw no + / − / ×). The options bar's own mode (`bar_badge`, #12853) keeps the -/// badged crosshair. Precise Other Cursors (or Caps Lock, `precise`) keep the plain crosshair, as -/// before: the reference was not measured there. +/// badged crosshair, with Precise Other Cursors or Caps Lock too, as before. Otherwise Precise +/// Other Cursors (or Caps Lock, `precise`) keep the plain crosshair, as before: the reference was +/// not measured in either case. pub(crate) fn object_selection_cursor(bar_badge: Option, precise: bool) -> Cursor { match bar_badge { Some(badge) => PaintedCursor::badged(craft::behavior::CursorIcon::Crosshair, badge).into(), diff --git a/crates/ui-egui/src/canvas/object_selection_cursor_tests.rs b/crates/ui-egui/src/canvas/object_selection_cursor_tests.rs index 79bddeca3a..751486d861 100644 --- a/crates/ui-egui/src/canvas/object_selection_cursor_tests.rs +++ b/crates/ui-egui/src/canvas/object_selection_cursor_tests.rs @@ -99,3 +99,16 @@ fn precise_other_cursors_and_caps_lock_keep_the_plain_crosshair() { WindowHost::of(&h.ctx).set_caps_lock(Some(true)); assert_eq!(cursor_with(&mut h, Modifiers::NONE), crosshair, "Caps Lock: the same crosshair"); } + +/// The options bar's badge wins over Precise Other Cursors and Caps Lock, as before this change +/// (not measured in the reference): the badged crosshair, not the plain one. +#[test] +fn a_bar_mode_keeps_its_badge_with_precise_cursors_and_caps_lock() { + let mut h = harness(Tool::ObjectSelection); + h.state_mut().ui.selection_mode = 2; + h.state_mut().run("prefs.set", json!({"path": "cursors.other", "value": "precise"})).unwrap(); + assert_eq!(badge_of(&cursor_with(&mut h, Modifiers::NONE)), Some(CursorBadge::Subtract), "Precise"); + h.state_mut().run("prefs.set", json!({"path": "cursors.other", "value": "standard"})).unwrap(); + WindowHost::of(&h.ctx).set_caps_lock(Some(true)); + assert_eq!(badge_of(&cursor_with(&mut h, Modifiers::NONE)), Some(CursorBadge::Subtract), "Caps Lock"); +}