mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
Document tool shortcut selection behavior
This commit is contained in:
1 parent
26a8215043
commit
4551b2a200
2 files changed
+7
-2
No files matched your search
@@ -903,8 +903,9 @@ fn handle_escape_and_view_keys(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
crate::opacity_keys::handle(app, ctx);
|
||||
}
|
||||
|
||||
/// Selects a tool from its letter key. Pressing the key of the current group cycles within it; with
|
||||
/// the Shift-switch preference only ⇧+key cycles. Returns true when a tool key was handled.
|
||||
/// Selects a tool from its letter key. Entering a group uses its remembered eligible tool or the
|
||||
/// first eligible tool in toolbar order. Pressing the key of the current group cycles within it.
|
||||
/// With the Shift-switch preference, only ⇧+key cycles. Returns true when a tool key was handled.
|
||||
fn select_tool_by_key(app: &mut PhotocraftApp, ctx: &egui::Context, pressed: &impl Fn(Key) -> bool) -> bool {
|
||||
let shift_switch = app.session.prefs().tools.use_shift_key_for_tool_switch;
|
||||
for t in Tool::ALL {
|
||||
|
||||
@@ -21,6 +21,7 @@ fn press(app: &mut PhotocraftApp, ctx: &egui::Context, key: Key, modifiers: Modi
|
||||
ctx.end_pass().textures_delta.clear();
|
||||
}
|
||||
|
||||
/// A fresh app enters each default letter group at its first toolbar tool under either preference.
|
||||
#[test]
|
||||
fn fresh_tool_letters_pick_the_first_tool_in_toolbar_order() {
|
||||
for shift_switch in [true, false] {
|
||||
@@ -43,6 +44,7 @@ fn fresh_tool_letters_pick_the_first_tool_in_toolbar_order() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A remembered Magic Wand takes precedence over the fresh W default, even when hidden.
|
||||
#[test]
|
||||
fn plain_w_returns_to_the_remembered_magic_wand() {
|
||||
for hidden in [false, true] {
|
||||
@@ -59,6 +61,8 @@ fn plain_w_returns_to_the_remembered_magic_wand() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Shift+W follows the flyout order and wraps. With the default preference, plain W keeps
|
||||
/// the current tool when it already belongs to the group.
|
||||
#[test]
|
||||
fn shift_w_cycles_in_toolbar_order() {
|
||||
let mut app = app();
|
||||
|
||||
Reference in new issue
Block a user