mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #658 - Support shift+UP/RIGHT/DOWN/LEFT to move the viewport
This commit is contained in:
parent
c2dbddcf9f
commit
b21ea30fa8
@ -64,6 +64,10 @@
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.RESET_ZOOM, this.resetZoom_.bind(this));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.INCREASE_ZOOM, this.updateZoom_.bind(this, 1));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.DECREASE_ZOOM, this.updateZoom_.bind(this, -1));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.OFFSET_UP, this.updateOffset_.bind(this, 'up'));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.OFFSET_RIGHT, this.updateOffset_.bind(this, 'right'));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.OFFSET_DOWN, this.updateOffset_.bind(this, 'down'));
|
||||
pskl.app.shortcutService.registerShortcut(shortcuts.MISC.OFFSET_LEFT, this.updateOffset_.bind(this, 'left'));
|
||||
|
||||
window.setTimeout(function () {
|
||||
this.afterWindowResize_();
|
||||
@ -262,6 +266,29 @@
|
||||
this.updateZoom_(modifier, coords);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the current viewport offset of 1 pixel in the provided direction.
|
||||
* Direction can be one of 'up', 'right', 'down', 'left'.
|
||||
* Callback for the OFFSET_${DIR} shortcuts.
|
||||
*/
|
||||
ns.DrawingController.prototype.updateOffset_ = function (direction) {
|
||||
var off = this.getOffset();
|
||||
if (direction === 'up') {
|
||||
off.y -= 1;
|
||||
} else if (direction === 'right') {
|
||||
off.x += 1;
|
||||
} else if (direction === 'down') {
|
||||
off.y += 1;
|
||||
} else if (direction === 'left') {
|
||||
off.x -= 1;
|
||||
}
|
||||
|
||||
this.setOffset(
|
||||
off.x,
|
||||
off.y
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the current zoom level by a given multiplier.
|
||||
*
|
||||
|
@ -61,7 +61,11 @@
|
||||
ONION_SKIN : createShortcut('onion-skin', 'Toggle onion skin', 'alt+O'),
|
||||
LAYER_PREVIEW : createShortcut('layer-preview', 'Toggle layer preview', 'alt+L'),
|
||||
MERGE_ANIMATION : createShortcut('import-animation', 'Open merge animation popup', 'ctrl+shift+M'),
|
||||
CLOSE_POPUP : createShortcut('close-popup', 'Close an opened popup', 'ESC')
|
||||
CLOSE_POPUP : createShortcut('close-popup', 'Close an opened popup', 'ESC'),
|
||||
OFFSET_UP : createShortcut('move-up', 'Move viewport up', 'shift+up'),
|
||||
OFFSET_RIGHT : createShortcut('move-right', 'Move viewport right', 'shift+right'),
|
||||
OFFSET_DOWN : createShortcut('move-down', 'Move viewport down', 'shift+down'),
|
||||
OFFSET_LEFT : createShortcut('move-left', 'Move viewport left', 'shift+left'),
|
||||
},
|
||||
|
||||
STORAGE : {
|
||||
|
Loading…
Reference in New Issue
Block a user