[Libreoffice-commits] online.git: loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 26 07:17:54 UTC 2020
loleaflet/src/control/Control.LokDialog.js | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit 46234cb85959cbf2a620f19f2c7fe38b2a6ccf13
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Mar 25 10:45:18 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Mar 26 08:17:36 2020 +0100
leaflet: refactor dialog isCursorVisible into member
Safer and more readable.
Change-Id: I37b551c0b8f7f445ed09a1ab24e00e06c64e8dad
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91082
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 67387016a..5d9edd5dc 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -158,6 +158,10 @@ L.Control.LokDialog = L.Control.extend({
return (id in this._dialogs) && this._dialogs[id].isCalcInputBar;
},
+ isCursorVisible: function(id) {
+ return (id in this._dialogs) && this._dialogs[id].cursorVisible;
+ },
+
_isSelectionHandle: function(el) {
return L.DomUtil.hasClass(el, 'leaflet-selection-marker-start') ||
L.DomUtil.hasClass(el, 'leaflet-selection-marker-end');
@@ -379,8 +383,9 @@ L.Control.LokDialog = L.Control.extend({
} else if (e.action === 'cursor_visible') {
// cursor_visible implies focus has changed, but can
// be misleading when it flips back on forth on typing!
- this._dialogs[e.id].cursorVisible = e.visible === 'true';
- if (this._dialogs[e.id].cursorVisible) {
+ var visible = (e.visible === 'true');
+ this._dialogs[e.id].cursorVisible = visible;
+ if (visible) {
$('#' + strId + '-cursor').css({display: 'block'});
this._map.fire('changefocuswidget', {winId: e.id, dialog: this, acceptInput: true}); // Us.
}
@@ -407,7 +412,7 @@ L.Control.LokDialog = L.Control.extend({
_updateDialogCursor: function(dlgId, x, y, height) {
var strId = this._toStrId(dlgId);
var dialogCursor = L.DomUtil.get(strId + '-cursor');
- var cursorVisible = dlgId in this._dialogs && this._dialogs[dlgId].cursorVisible;
+ var cursorVisible = this.isCursorVisible(dlgId);
L.DomUtil.setStyle(dialogCursor, 'height', height + 'px');
L.DomUtil.setStyle(dialogCursor, 'display', cursorVisible ? 'block' : 'none');
// set the position of the cursor container element
@@ -574,12 +579,12 @@ L.Control.LokDialog = L.Control.extend({
if (window.mode.isMobile()) {
if (!this.mobileSidebarVisible)
return;
- // On desktop, grab the focus only when there is a visible cursor on the sidebar.
- } else if (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible) {
+ } else if (!this._isOpen(dlgId) || !this.isCursorVisible(dlgId)) {
+ // On desktop, grab the focus only when there is a visible cursor on the sidebar.
return;
}
}
- else if (this._isCalcInputBar(dlgId) && (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible)) {
+ else if (this._isCalcInputBar(dlgId) && (!this._isOpen(dlgId) || !this.isCursorVisible(dlgId))) {
return;
}
More information about the Libreoffice-commits
mailing list