Fix hint manager, add hint visible checks to close panels in left menu
This commit is contained in:
parent
87413ce121
commit
8bf91f4847
|
@ -58,7 +58,8 @@ Common.UI.HintManager = new(function() {
|
||||||
_currentSection = document,
|
_currentSection = document,
|
||||||
_currentControls = [],
|
_currentControls = [],
|
||||||
_currentHints = [],
|
_currentHints = [],
|
||||||
_inputLetters = '';
|
_inputLetters = '',
|
||||||
|
_isClear = false;
|
||||||
|
|
||||||
var _setCurrentSection = function (btn) {
|
var _setCurrentSection = function (btn) {
|
||||||
if (btn === 'esc') {
|
if (btn === 'esc') {
|
||||||
|
@ -324,11 +325,11 @@ Common.UI.HintManager = new(function() {
|
||||||
var tag = curr.prop("tagName").toLowerCase();
|
var tag = curr.prop("tagName").toLowerCase();
|
||||||
if (window.SSE && curr.parent().prop('id') === 'statusbar_bottom') {
|
if (window.SSE && curr.parent().prop('id') === 'statusbar_bottom') {
|
||||||
curr.contextmenu();
|
curr.contextmenu();
|
||||||
_hideHints();
|
_clearHints();
|
||||||
} else if (tag === 'input' || tag === 'textarea') {
|
} else if (tag === 'input' || tag === 'textarea') {
|
||||||
curr.trigger(jQuery.Event('click', {which: 1}));
|
curr.trigger(jQuery.Event('click', {which: 1}));
|
||||||
curr.focus();
|
curr.focus();
|
||||||
_hideHints();
|
_clearHints();
|
||||||
} else {
|
} else {
|
||||||
if (!curr.attr('content-target') || (curr.attr('content-target') && !$(`#${curr.attr('content-target')}`).is(':visible'))) { // need to open panel
|
if (!curr.attr('content-target') || (curr.attr('content-target') && !$(`#${curr.attr('content-target')}`).is(':visible'))) { // need to open panel
|
||||||
if (!($('#file-menu-panel').is(':visible') && (curr.parent().prop('id') === 'fm-btn-info' && $('#panel-info').is(':visible') ||
|
if (!($('#file-menu-panel').is(':visible') && (curr.parent().prop('id') === 'fm-btn-info' && $('#panel-info').is(':visible') ||
|
||||||
|
@ -341,23 +342,22 @@ Common.UI.HintManager = new(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curr.prop('id') === 'btn-goback' || curr.closest('.btn-slot').prop('id') === 'slot-btn-options' || curr.prop('id') === 'left-btn-thumbs') {
|
if (curr.prop('id') === 'btn-goback' || curr.closest('.btn-slot').prop('id') === 'slot-btn-options' || curr.prop('id') === 'left-btn-thumbs') {
|
||||||
_hideHints();
|
_clearHints();
|
||||||
_resetToDefault();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (curr.prop('id') === 'add-comment-doc') {
|
if (curr.prop('id') === 'add-comment-doc') {
|
||||||
_removeHints();
|
_removeHints();
|
||||||
_currentHints.length = 0;
|
_currentHints.length = 0;
|
||||||
_currentControls.length = 0;
|
_currentControls.length = 0;
|
||||||
} else {
|
_showHints();
|
||||||
_nextLevel();
|
return;
|
||||||
}
|
}
|
||||||
|
if (!_isClear) {
|
||||||
|
_nextLevel();
|
||||||
_setCurrentSection(curr);
|
_setCurrentSection(curr);
|
||||||
_showHints();
|
_showHints();
|
||||||
}
|
}
|
||||||
if (!_hintVisible) { // if there isn't new level, reset settings to start
|
|
||||||
_resetToDefault();
|
|
||||||
}
|
}
|
||||||
|
_isClear = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -380,7 +380,7 @@ Common.UI.HintManager = new(function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var _needCloseMenu = function () {
|
var _needCloseFileMenu = function () {
|
||||||
return !(_hintVisible && _currentLevel > 1);
|
return !(_hintVisible && _currentLevel > 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -388,12 +388,18 @@ Common.UI.HintManager = new(function() {
|
||||||
if (_hintVisible) {
|
if (_hintVisible) {
|
||||||
_hideHints();
|
_hideHints();
|
||||||
_resetToDefault();
|
_resetToDefault();
|
||||||
|
_isClear = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _isHintVisible = function () {
|
||||||
|
return _hintVisible;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: _init,
|
init: _init,
|
||||||
clearHints: _clearHints,
|
clearHints: _clearHints,
|
||||||
needCloseMenu: _needCloseMenu
|
needCloseFileMenu: _needCloseFileMenu,
|
||||||
|
isHintVisible: _isHintVisible
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -156,7 +156,7 @@ define([
|
||||||
this._onBtnAddMessage(event);
|
this._onBtnAddMessage(event);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (event.keyCode == Common.UI.Keys.ESC) {
|
if (event.keyCode == Common.UI.Keys.ESC && !Common.UI.HintManager.isHintVisible()) {
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -808,7 +808,7 @@ define([
|
||||||
case 'escape':
|
case 'escape':
|
||||||
// if (!this.leftMenu.isOpened()) return true;
|
// if (!this.leftMenu.isOpened()) return true;
|
||||||
if ( this.leftMenu.menuFile.isVisible() ) {
|
if ( this.leftMenu.menuFile.isVisible() ) {
|
||||||
if (Common.UI.HintManager.needCloseMenu())
|
if (Common.UI.HintManager.needCloseFileMenu())
|
||||||
this.leftMenu.menuFile.hide();
|
this.leftMenu.menuFile.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -828,8 +828,10 @@ define([
|
||||||
}
|
}
|
||||||
if (this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
if (this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
||||||
$(e.target).parents('#left-menu').length ) {
|
$(e.target).parents('#left-menu').length ) {
|
||||||
|
if (!Common.UI.HintManager.isHintVisible()) {
|
||||||
this.leftMenu.close();
|
this.leftMenu.close();
|
||||||
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -301,6 +301,7 @@ define([
|
||||||
|
|
||||||
if (key == Common.UI.Keys.ESC) {
|
if (key == Common.UI.Keys.ESC) {
|
||||||
Common.UI.Menu.Manager.hideAll();
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
if (!Common.UI.HintManager.isHintVisible())
|
||||||
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
|
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -673,7 +673,7 @@ define([
|
||||||
// if (!this.leftMenu.isOpened()) return true;
|
// if (!this.leftMenu.isOpened()) return true;
|
||||||
// TODO:
|
// TODO:
|
||||||
if ( this.leftMenu.menuFile.isVisible() ) {
|
if ( this.leftMenu.menuFile.isVisible() ) {
|
||||||
if (Common.UI.HintManager.needCloseMenu())
|
if (Common.UI.HintManager.needCloseFileMenu())
|
||||||
this.leftMenu.menuFile.hide();
|
this.leftMenu.menuFile.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -694,8 +694,10 @@ define([
|
||||||
|
|
||||||
if ( this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
if ( this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
||||||
$(e.target).parents('#left-menu').length ) {
|
$(e.target).parents('#left-menu').length ) {
|
||||||
|
if (!Common.UI.HintManager.isHintVisible()) {
|
||||||
this.leftMenu.close();
|
this.leftMenu.close();
|
||||||
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -303,6 +303,7 @@ define([
|
||||||
}
|
}
|
||||||
if (key == Common.UI.Keys.ESC) {
|
if (key == Common.UI.Keys.ESC) {
|
||||||
Common.UI.Menu.Manager.hideAll();
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
if (!Common.UI.HintManager.isHintVisible())
|
||||||
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
|
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,7 +847,7 @@ define([
|
||||||
return false;
|
return false;
|
||||||
case 'escape':
|
case 'escape':
|
||||||
if ( this.leftMenu.menuFile.isVisible() ) {
|
if ( this.leftMenu.menuFile.isVisible() ) {
|
||||||
if (Common.UI.HintManager.needCloseMenu())
|
if (Common.UI.HintManager.needCloseFileMenu())
|
||||||
this.leftMenu.menuFile.hide();
|
this.leftMenu.menuFile.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -867,8 +867,10 @@ define([
|
||||||
}
|
}
|
||||||
if ( this.leftMenu.btnAbout.pressed ||
|
if ( this.leftMenu.btnAbout.pressed ||
|
||||||
($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) {
|
($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) {
|
||||||
|
if (!Common.UI.HintManager.isHintVisible()) {
|
||||||
this.leftMenu.close();
|
this.leftMenu.close();
|
||||||
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.mode.isEditDiagram || this.mode.isEditMailMerge) {
|
if (this.mode.isEditDiagram || this.mode.isEditMailMerge) {
|
||||||
|
|
Loading…
Reference in a new issue