pixcil icon indicating copy to clipboard operation
pixcil copied to clipboard

Add keyboard shortcuts

Open ephetic opened this issue 1 year ago • 6 comments

It would be nice if the webapp and VSCode extension supported some or all of these. Suggested bindings are given, but are only suggestions.

  • switch tools (e.g. TAB to cycle tool, or individual keys like P for Pen, H for Hand, E for Erase, etc)
  • switch color (e.g. C to cycle (maybe by order of last used), or numbers to directly select form palette)
  • switch frame (e.g. < >)
  • change tool size (e.g. + -)
  • copy, paste, save, undo (e.g. CMD+C, CMD+V, CMD+S, CMD+Z)
  • modifiers for mouse driven zoom, pan, and select (e.g. SHIFT+Drag for select, CMD+Scroll for zoom, ALT+Drag (or H+Drag) for pan)
  • Keyboard driven drawing: arrows to move cursor, SPACE to mark.

Additionally, it'd be nice if there were a help menu for these shortcuts, e.g. a question mark icon button on the settings menu opening a text modal.

Thank you again for all you've done. I love this thing. I would try to give you a PR, but I can't follow the Rust.

ephetic avatar Apr 06 '25 04:04 ephetic

What's your dev workflow for Rust -> WASM? Do you have the ability to attach a debugger or even add logging?

ephetic avatar Apr 06 '25 05:04 ephetic

Thank you for this feature request.

I'm positive about implementing those keyboard shortcuts and plan to work on them next week.

It would be nice if there were a help menu for these shortcuts, e.g., a question mark icon button on the settings menu that opens a text modal.

I agree this would be a nice addition, but it would be somewhat challenging to design and implement. Therefore, it will remain outside the scope of next week's implementation.

What's your dev workflow for Rust -> WASM? Do you have the ability to attach a debugger or even add logging?

For my development workflow, I use Rust's logging macros such as log::debug!("message"), which display output in the browser's console log viewer. I haven't used a debugger specifically for WASM as I think it could be challenging to set up.

sile avatar Apr 06 '25 11:04 sile

[FYI] I've started implementing key bindings (first pull request: #17). Over the coming weeks, I plan to add support for the other keyboard shortcuts you proposed (excluding those that would require extensive code restructuring to implement).

sile avatar Apr 13 '25 01:04 sile

Fantastic! Works as described!

ephetic avatar Apr 13 '25 04:04 ephetic

I've released version 0.9.0 which includes the following keyboard shortcuts:

Key Action
TAB Switch to next tool
BACKTAB Switch to prev tool
p Switch to PICK tool
d Switch to DRAW tool
f Switch to FILL tool
e Switch to ERASE tool
s Switch to SELECT tool
m Switch to MOVE tool
Ctrl-z undo
Ctrl-y redo
< Switch to prev frame
> Switch to next frame

Although the shortcuts you proposed seem nice, implementing them would require significant refactoring. I'd like to try implementing these changes when I have more time available, though I'm uncertain when that might be.

sile avatar Apr 19 '25 12:04 sile

You're the best! Thank you!

ephetic avatar Apr 19 '25 15:04 ephetic