Created
November 4, 2015 10:20
works on chrome, not on firefox ( event is not defined )
This file contains hidden or 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