loleaflet/src/control/Control.LokDialog.js | 17 +++++++++++------ loleaflet/src/map/Map.js | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)
New commits: commit af1dd174b6aba48151bdb9e7286545433a876dad Author: Ashod Nakashian <[email protected]> AuthorDate: Wed Mar 25 10:45:18 2020 -0400 Commit: Andras Timar <[email protected]> CommitDate: Thu Mar 26 17:59:00 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 <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91135 Tested-by: Andras Timar <[email protected]> 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; } commit 2b4e95ef004173be055b1d6592b6ba7c097911a4 Author: Ashod Nakashian <[email protected]> AuthorDate: Wed Mar 25 09:24:46 2020 -0400 Commit: Andras Timar <[email protected]> CommitDate: Thu Mar 26 17:58:47 2020 +0100 leaflet: hide the cursor when a dialog has the focus Change-Id: I3482a227d508b0a24adc875833de91091ee66a2f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91054 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91134 Tested-by: Andras Timar <[email protected]> diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 38f0803dc..34f3cc9a7 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -1415,6 +1415,7 @@ L.Map = L.Evented.extend({ } else if (acceptInput !== undefined) { // A dialog has the focus. this.focus(acceptInput); + this._textInput.hideCursor(); // The cursor is in the dialog. } }, _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
