From 19893d33e35d05eb104bfc53174b9f112318d479 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 May 2020 08:53:18 +0300 Subject: only bind up/down in 3 panel mode --- js/AppBase.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'js/AppBase.js') diff --git a/js/AppBase.js b/js/AppBase.js index 4aa500e5b..8f9d71653 100644 --- a/js/AppBase.js +++ b/js/AppBase.js @@ -134,6 +134,17 @@ define(["dojo/_base/declare"], function (declare) { } }, + getActionByHotkeySequence: function (sequence) { + const hotkeys_map = App.getInitParam("hotkeys"); + + for (const seq in hotkeys_map[1]) { + if (hotkeys_map[1].hasOwnProperty(seq)) { + if (seq == sequence) { + return hotkeys_map[1][seq]; + } + } + } + }, keyeventToAction: function(event) { const hotkeys_map = App.getInitParam("hotkeys"); @@ -177,18 +188,16 @@ define(["dojo/_base/declare"], function (declare) { hotkey_name = keychar ? keychar : "(" + keycode + ")"; } - const hotkey_full = this.hotkey_prefix ? this.hotkey_prefix + " " + hotkey_name : hotkey_name; + let hotkey_full = this.hotkey_prefix ? this.hotkey_prefix + " " + hotkey_name : hotkey_name; this.hotkey_prefix = false; - let action_name = false; + let action_name = this.getActionByHotkeySequence(hotkey_full); - for (const sequence in hotkeys_map[1]) { - if (hotkeys_map[1].hasOwnProperty(sequence)) { - if (sequence == hotkey_full) { - action_name = hotkeys_map[1][sequence]; - break; - } - } + // check for mode-specific hotkey + if (!action_name) { + hotkey_full = (App.isCombinedMode() ? "{C}" : "{3}") + hotkey_full; + + action_name = this.getActionByHotkeySequence(hotkey_full); } console.log('keyeventToAction', hotkey_full, '=>', action_name); -- cgit v1.2.3