diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2020-03-24 16:44:11 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-03-26 17:57:39 +0100 |
commit | 38b97e1791eb472cd320e3b2f1560a87c43c9e0f (patch) | |
tree | be713d71cfb7a804e0cd529b8693ef00d4644af6 | |
parent | 769d4c7e1f742bc9d39516b1f5fd979468ba56cd (diff) |
leaflet: reuse member functions
Change-Id: I8c0c58d2ab175b271df200de2b100e61c655db5f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91018
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91130
-rw-r--r-- | loleaflet/src/map/Map.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index f8522d1b8..024192295 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -874,7 +874,8 @@ L.Map = L.Evented.extend({ return this._winId; }, - // Returns true iff the document has input focus. + // Returns true iff the document has input focus, + // as opposed to a dialog, sidebar, formula bar, etc. editorHasFocus: function () { return this.getWinId() === 0; }, @@ -1403,7 +1404,7 @@ L.Map = L.Evented.extend({ _changeFocusWidget: function (dialog, winId, acceptInput) { if (!this._loaded) { return; } - this._winId = winId; + this.setWinId(winId); this._activeDialog = dialog; this._isSearching = false; @@ -1431,11 +1432,11 @@ L.Map = L.Evented.extend({ // Our browser tab got focus. _onGotFocus: function () { - if (this._winId === 0) { + if (this.editorHasFocus()) { this.fire('editorgotfocus'); } else if (this._activeDialog) { - this._activeDialog.focus(this._winId); + this._activeDialog.focus(this.getWinId()); } this._activate(); |