mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-24 09:57:08 -06:00
It passed through to Edit > Free Transform, which started transforming the layer being typed into. As in Photoshop, it now toggles the Character panel and editing continues. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dd963b4b44
commit
74c7980146
@@ -518,6 +518,11 @@ pub fn handle_keys(app: &mut PhotocraftApp, ctx: &egui::Context) -> bool {
|
||||
e.caret = n;
|
||||
}
|
||||
}
|
||||
// Photoshop: while editing type, ⌘/Ctrl+T shows or hides the Character panel
|
||||
// (Free Transform of the layer being typed into is not what it means here).
|
||||
Key::T if m.command && !m.shift && !m.alt => {
|
||||
let _ = crate::menus::invoke(app, ctx, "window.panel.character", json!({}));
|
||||
}
|
||||
// Other command shortcuts (⌘Z, ⌘S, …) pass through to the menus.
|
||||
_ if m.command => handled[k] = false,
|
||||
_ => {}
|
||||
|
||||
@@ -434,3 +434,21 @@ fn vertical_type_tool_creates_point_and_paragraph_text_with_one_undo() {
|
||||
assert!(app.session.active().unwrap().doc.layer(id).is_none());
|
||||
}
|
||||
}
|
||||
|
||||
/// #668: ⌘/Ctrl+T while typing shows or hides the Character panel, as in Photoshop, instead of
|
||||
/// starting Free Transform on the layer being typed into.
|
||||
#[test]
|
||||
fn command_t_while_typing_toggles_the_character_panel() {
|
||||
let mut app = new_app();
|
||||
let id = LayerId(app.run("type.create", json!({"text": "HOHO", "size": 60, "x": 300, "y": 420})).unwrap()["layer"].as_u64().unwrap());
|
||||
let mut h = harness(1.0, app);
|
||||
let p = glyph(&mut h, id, 1, 0.5);
|
||||
click(&mut h, p);
|
||||
assert!(h.state().ui.text_edit.is_some(), "editing");
|
||||
let before = crate::view_cmds::checked(h.state(), "window.panel.character");
|
||||
h.event(egui::Event::Key { key: egui::Key::T, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND });
|
||||
h.run_steps(2);
|
||||
assert!(h.state().ui.transform.is_none(), "no Free Transform while typing");
|
||||
assert!(h.state().ui.text_edit.is_some(), "still editing");
|
||||
assert_ne!(crate::view_cmds::checked(h.state(), "window.panel.character"), before, "the Character panel toggled");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user