mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #258 : add support for left/right keys + bugfix
This commit is contained in:
parent
3525b318a6
commit
12ac85f0f6
@ -50,9 +50,10 @@
|
||||
var shortcut = pskl.app.shortcutService.getShortcutById(shortcutId);
|
||||
|
||||
if (shortcutEl.classList.contains(SHORTCUT_EDITING_CLASSNAME)) {
|
||||
shortcutEl.classList.remove(SHORTCUT_EDITING_CLASSNAME);
|
||||
pskl.utils.Dom.removeClass(SHORTCUT_EDITING_CLASSNAME);
|
||||
this.eventTrapInput.blur();
|
||||
} else if (shortcut.isEditable()) {
|
||||
pskl.utils.Dom.removeClass(SHORTCUT_EDITING_CLASSNAME);
|
||||
shortcutEl.classList.add(SHORTCUT_EDITING_CLASSNAME);
|
||||
this.eventTrapInput.focus();
|
||||
}
|
||||
@ -64,11 +65,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var shortcutKeyObject = pskl.service.keyboard.KeyUtils.createKeyFromEvent(evt);
|
||||
if (!shortcutKeyObject) {
|
||||
return;
|
||||
}
|
||||
|
||||
var shortcutKeyString = pskl.service.keyboard.KeyUtils.stringify(shortcutKeyObject);
|
||||
var shortcutId = shortcutEl.dataset.shortcutId;
|
||||
var shortcut = pskl.app.shortcutService.getShortcutById(shortcutId);
|
||||
var shortcutKeyObject = pskl.service.keyboard.KeyUtils.createKeyFromEvent(evt);
|
||||
var shortcutKeyString = pskl.service.keyboard.KeyUtils.stringify(shortcutKeyObject);
|
||||
|
||||
pskl.app.shortcutService.updateShortcut(shortcut, shortcutKeyString);
|
||||
|
||||
shortcutEl.classList.remove(SHORTCUT_EDITING_CLASSNAME);
|
||||
@ -147,7 +151,9 @@
|
||||
if (pskl.utils.UserAgent.isMac) {
|
||||
key = key.replace('ctrl', 'cmd');
|
||||
}
|
||||
key = key.replace(/left/i, '←');
|
||||
key = key.replace(/up/i, '↑');
|
||||
key = key.replace(/right/i, '→');
|
||||
key = key.replace(/down/i, '↓');
|
||||
key = key.replace(/>/g, '>');
|
||||
key = key.replace(/</g, '<');
|
||||
|
@ -3,7 +3,9 @@
|
||||
191 : '?',
|
||||
8 : 'back',
|
||||
27 : 'esc',
|
||||
37 : 'left',
|
||||
38 : 'up',
|
||||
39 : 'right',
|
||||
40 : 'down',
|
||||
46 : 'del',
|
||||
189 : '-',
|
||||
|
Loading…
Reference in New Issue
Block a user