Created
November 4, 2015 10:20
-
-
Save oviava/8c44c7f79260ce89ab9f to your computer and use it in GitHub Desktop.
works on chrome, not on firefox ( event is not defined )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleKeyDown(e) { | |
if (!e.ctrlKey) { | |
return; | |
} | |
e.preventDefault(); | |
const key = event.keyCode || event.which; | |
const char = String.fromCharCode(key); | |
switch (char.toUpperCase()) { | |
case this.props.toggleVisibilityKey.toUpperCase(): | |
this.props.dispatch(toggleVisibility()); | |
break; | |
case this.props.changePositionKey.toUpperCase(): | |
this.props.dispatch(changePosition()); | |
break; | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment