chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 248 forks source link

Only delete duplicate if it duplicates both combo and action #193

Open jbrecht opened 8 years ago

jbrecht commented 8 years ago

Duplicate deletion introduced in a3b4b4c233abca579d186543b46c011580a42f65 is over-eager, and will reduce 'duplicates' when we bind different callbacks to, say, keyup vs. keydown actions for the same combo

chieffancypants commented 8 years ago

Are there valid use-cases where different callbacks are used for different actions?

jbrecht commented 8 years ago

Yes, that's why I had to create this. As I said in the description, you may want to bind to both keyup and keydown for the same key. In our particular case, for example, when you use our drawing tool and hold down the shift key it constrains what the tool does (e.g. the rectangle tool only draws squares if shift is down) and so I need to detect when shift is pressed down and also detect when it was released. Moreover the existence of 'action' as a config field strongly implies you ought to be able to create action-specific bindings and expect them to work

evanbeard commented 8 years ago

+1 - have the same need to bind both keyup and keydown

DioNNiS commented 8 years ago

+1