Hint Manager: add timer, disable processing of other shortcuts when hints are visible

This commit is contained in:
JuliaSvinareva 2021-07-13 12:02:06 +03:00
parent 3a65ac540f
commit b8a660068f
2 changed files with 10 additions and 3 deletions

View file

@ -60,7 +60,8 @@ Common.UI.HintManager = new(function() {
_currentHints = [],
_inputLetters = '',
_isComplete = false,
_isLockedKeyEvents = false;
_isLockedKeyEvents = false,
_inputTimer;
var _api;
@ -96,6 +97,11 @@ Common.UI.HintManager = new(function() {
_currentHints.forEach(function(item) {
item.show();
});
_inputTimer = setInterval(function () {
if (_inputLetters.length > 0) {
_inputLetters = '';
}
}, 5000);
} else {
_hintVisible = false;
}
@ -106,6 +112,7 @@ Common.UI.HintManager = new(function() {
_currentHints && _currentHints.forEach(function(item) {
item.hide()
});
clearInterval(_inputTimer);
};
var _nextLevel = function() {

View file

@ -71,6 +71,8 @@
var key, handler, k, i, modifiersMatch, scope;
key = event.keyCode;
if (key !== 27 && Common.UI.HintManager.isHintVisible()) return;
if (index(_downKeys, key) == -1) {
_downKeys.push(key);
}
@ -105,8 +107,6 @@
for(k in _mods)
if((!_mods[k] && index(handler.mods, +k) > -1) ||
(_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
if (modifiersMatch)
Common.NotificationCenter.trigger('hints:clear');
// call the handler and stop the event if neccessary
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
if(locked===true || handler.locked || handler.method(event, handler)===false){