Skip to content

Commit

Permalink
Add metaKey and altKey handling in keyboard handler
Browse files Browse the repository at this point in the history
Resolve #549.
  • Loading branch information
Hyunje Jun committed Oct 18, 2016
1 parent 898928b commit 0fc5c69
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/js/plugin/handler/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,40 @@ function bindKeyboardHandler(element, i) {

switch (e.which) {
case 37: // left
deltaX = -30;
if (e.metaKey) {
deltaX = -i.contentWidth;
} else if (e.altKey) {
deltaX = -i.containerWidth;
} else {
deltaX = -30;
}
break;
case 38: // up
deltaY = 30;
if (e.metaKey) {
deltaY = i.contentHeight;
} else if (e.altKey) {
deltaY = i.containerHeight;
} else {
deltaY = 30;
}
break;
case 39: // right
deltaX = 30;
if (e.metaKey) {
deltaX = i.contentWidth;
} else if (e.altKey) {
deltaX = i.containerWidth;
} else {
deltaX = 30;
}
break;
case 40: // down
deltaY = -30;
if (e.metaKey) {
deltaY = -i.contentHeight;
} else if (e.altKey) {
deltaY = -i.containerHeight;
} else {
deltaY = -30;
}
break;
case 33: // page up
deltaY = 90;
Expand Down

0 comments on commit 0fc5c69

Please sign in to comment.