Add metaKey and altKey handling in keyboard handler

Resolve #549.
This commit is contained in:
Hyunje Jun 2016-10-18 11:49:20 +09:00
parent 898928b686
commit 0fc5c69b3f

View File

@ -71,16 +71,40 @@ function bindKeyboardHandler(element, i) {
switch (e.which) { switch (e.which) {
case 37: // left case 37: // left
deltaX = -30; if (e.metaKey) {
deltaX = -i.contentWidth;
} else if (e.altKey) {
deltaX = -i.containerWidth;
} else {
deltaX = -30;
}
break; break;
case 38: // up case 38: // up
deltaY = 30; if (e.metaKey) {
deltaY = i.contentHeight;
} else if (e.altKey) {
deltaY = i.containerHeight;
} else {
deltaY = 30;
}
break; break;
case 39: // right case 39: // right
deltaX = 30; if (e.metaKey) {
deltaX = i.contentWidth;
} else if (e.altKey) {
deltaX = i.containerWidth;
} else {
deltaX = 30;
}
break; break;
case 40: // down case 40: // down
deltaY = -30; if (e.metaKey) {
deltaY = -i.contentHeight;
} else if (e.altKey) {
deltaY = -i.containerHeight;
} else {
deltaY = -30;
}
break; break;
case 33: // page up case 33: // page up
deltaY = 90; deltaY = 90;