Open creage opened 12 years ago
There are lots of edge-cases to this that would require looking at. It would be a nice to have but not a priority, unless you want to submit a PR?
Currently I see that jwerty is explicitly lowercases all of codes. What if we just leave all of codes as users bind them?
It lowercases codes to make selection of said codes easier. If you jwerty.key("shift+q"...
it should fire on those to keys pressed in combination, its a little ambiguious to use jwerty.key("Q"...
or jwerty.key("q"
, as it can be prone to errors or typos (other typos could include jwerty.key("Shift+q"...
Also there is a case where if the caps-lock is on, what key does it fire? Q or q?
OK. For now I'm dealing like this
if (key == key.toUpperCase()) { key = key + "/shift+" + key; }
Well, imagine you have a binding like "Q", and "q" - both of them are fired by hitting "Q" key on your keyboard.
But if you somehow display these keys on the screen of your app - users type shift+q to match the uppercase "Q", and just q for lowercase "q".
Hence, it would be nice if jwerty could detect shift+key, if bound key IS IN uppercase.