cdglabs / apparatus

A hybrid graphics editor and programming environment for creating interactive diagrams.
http://aprt.us/
MIT License
1.03k stars 58 forks source link

Holding Command/ALT while scrubbing an attribute value should adjust by increments of 0.1 #19

Open JanMiksovsky opened 8 years ago

JanMiksovsky commented 8 years ago

Feature suggestion: Holding Command (on Mac) while dragging an object constrains its X/Y to discrete multiples of 0.1, which is useful for aligning to the background grid. When dragging an attribute value in the inspector to the left or right to "scrub" the value, it would similarly be useful to be able to hold down Command and scrub the value in discrete 0.1 increments.

Related: Holding ALT on Windows should have the same effect as holding Command on Mac. Or use Control on both platforms?

electronicwhisper commented 8 years ago

Yeah. I actually had this in the code but it was commented out... Anyway, I pushed a fix.

For windows, yes, this remap is annoying. I'm using the keymaster library to track which modifier keys are held down. I feel like we want an abstraction that will look at the platform (windows/mac/unix/etc) and "translate" the modifier keys into some semantically equivalent space. So command on mac and ctrl on windows would both be the "same" key at this abstraction level. Anyone know of a library that does this? Or a snippet of code? Seems like a handy thing for anyone making a non-trivial web app.

It would be nice if it even translated common key shortcuts semantically. For example, cmd+shift+z is redo on mac, whereas ctrl+y is redo on windows. https://github.com/cdglabs/apparatus/blob/master/src/View/Menubar.coffee#L34-L59