mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Object Selection cursor: say that the options bar's badge wins over precise cursors, and test it (CodeRabbit on cursor_policy.rs:80)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d3e0e8e9a3
commit
461acded49
2 files changed
+16
-2
No files matched your search
@@ -73,8 +73,9 @@ pub(crate) fn click_tool_cursor(tool: Tool, precise: bool) -> Option<Cursor> {
|
||||
/// 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<CursorBadge>, precise: bool) -> Cursor {
|
||||
match bar_badge {
|
||||
Some(badge) => PaintedCursor::badged(craft::behavior::CursorIcon::Crosshair, badge).into(),
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
Reference in new issue
Block a user