yishn / tikzcd-editor

A simple visual editor for creating commutative diagrams.
https://tikzcd.yichuanshen.de/
MIT License
1.87k stars 100 forks source link

Implement basic keyboard controls for manipulating edges #13

Closed cemulate closed 6 years ago

cemulate commented 6 years ago

Clicking the far away buttons for changing edge properties was driving me crazy!

I've implemented basic keyboard navigation for when you have an edge selected. If you have better ideas about what keys should be used, I'd love to hear them, but the basic idea is there.

I've renamed data in App to be a little more descriptive and match the corresponding stuff I added in Properties

yishn commented 6 years ago

Apologies for the delay. Here are some thoughts:

cemulate commented 6 years ago

No prob on the delay.

I like your idea about "up" and "down" considering that matches the icons. I've also moved all that I can to keyup. Unfortunately, the Enter to edit cannot be on keyup, since if you're editing the label the Enter press that triggers form submission does so on keydown which means you immediately open the edit label again on keyup (if you have a better idea to handle that, let me know).

My logic for the label movement just comes from using WASD as the left set of arrows - most peoples' hands will be resting there anyway, and it seemed like a natural choice for left-middle-right.

Just realized I forgot to hint the buttons, I'll do that real quick as well.

yishn commented 6 years ago

Thank you very much!