Hint Manager: add timer, disable processing of other shortcuts when hints are visible
This commit is contained in:
parent
3a65ac540f
commit
b8a660068f
|
@ -60,7 +60,8 @@ Common.UI.HintManager = new(function() {
|
||||||
_currentHints = [],
|
_currentHints = [],
|
||||||
_inputLetters = '',
|
_inputLetters = '',
|
||||||
_isComplete = false,
|
_isComplete = false,
|
||||||
_isLockedKeyEvents = false;
|
_isLockedKeyEvents = false,
|
||||||
|
_inputTimer;
|
||||||
|
|
||||||
var _api;
|
var _api;
|
||||||
|
|
||||||
|
@ -96,6 +97,11 @@ Common.UI.HintManager = new(function() {
|
||||||
_currentHints.forEach(function(item) {
|
_currentHints.forEach(function(item) {
|
||||||
item.show();
|
item.show();
|
||||||
});
|
});
|
||||||
|
_inputTimer = setInterval(function () {
|
||||||
|
if (_inputLetters.length > 0) {
|
||||||
|
_inputLetters = '';
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
} else {
|
} else {
|
||||||
_hintVisible = false;
|
_hintVisible = false;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +112,7 @@ Common.UI.HintManager = new(function() {
|
||||||
_currentHints && _currentHints.forEach(function(item) {
|
_currentHints && _currentHints.forEach(function(item) {
|
||||||
item.hide()
|
item.hide()
|
||||||
});
|
});
|
||||||
|
clearInterval(_inputTimer);
|
||||||
};
|
};
|
||||||
|
|
||||||
var _nextLevel = function() {
|
var _nextLevel = function() {
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
var key, handler, k, i, modifiersMatch, scope;
|
var key, handler, k, i, modifiersMatch, scope;
|
||||||
key = event.keyCode;
|
key = event.keyCode;
|
||||||
|
|
||||||
|
if (key !== 27 && Common.UI.HintManager.isHintVisible()) return;
|
||||||
|
|
||||||
if (index(_downKeys, key) == -1) {
|
if (index(_downKeys, key) == -1) {
|
||||||
_downKeys.push(key);
|
_downKeys.push(key);
|
||||||
}
|
}
|
||||||
|
@ -105,8 +107,6 @@
|
||||||
for(k in _mods)
|
for(k in _mods)
|
||||||
if((!_mods[k] && index(handler.mods, +k) > -1) ||
|
if((!_mods[k] && index(handler.mods, +k) > -1) ||
|
||||||
(_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
|
(_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
|
// call the handler and stop the event if neccessary
|
||||||
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
||||||
if(locked===true || handler.locked || handler.method(event, handler)===false){
|
if(locked===true || handler.locked || handler.method(event, handler)===false){
|
||||||
|
|
Loading…
Reference in a new issue