diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2020-01-13 10:34:48 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2020-01-28 11:43:53 +0100 |
commit | b7e05a11896db7c08972ff84e247df7b8875c314 (patch) | |
tree | 8f9cea07d2ed593b8dd4322c909e623f3f9f7e94 | |
parent | Adjust the row/col header fontSize with zoom-level (diff) | |
download | online-b7e05a11896db7c08972ff84e247df7b8875c314.tar.gz online-b7e05a11896db7c08972ff84e247df7b8875c314.zip |
leaflet: move isFocused to map
Change-Id: Ie0776b5bca8728f69eccd3b6d83b9bbe8358ab0f
-rw-r--r-- | loleaflet/src/layer/tile/TileLayer.js | 8 | ||||
-rw-r--r-- | loleaflet/src/map/Map.js | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 731f10a495..cad28c9b37 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -101,8 +101,6 @@ L.TileLayer = L.GridLayer.extend({ this._documentInfo = ''; // Position and size of the visible cursor. this._visibleCursor = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); - // Do we have focus - ie. should we render a cursor - this._isFocused = true; // Last cursor position for invalidation this.lastCursorPos = this._visibleCursor.getNorthWest(); // Are we zooming currently ? - if so, no cursor. @@ -1119,7 +1117,7 @@ L.TileLayer = L.GridLayer.extend({ .openOn(this._map); } - if (!this._isFocused && (modifierViewId === this._viewId) && (this._map.getWinId === 0) && (this._map._permission === 'edit')) { + if (!this._map._isFocused && (modifierViewId === this._viewId) && (this._map.getWinId === 0) && (this._map._permission === 'edit')) { // Regain cursor if we had been out of focus and now have input. // (only if it is our own cursor and the input is actually not // going into a dialog) @@ -2094,7 +2092,7 @@ L.TileLayer = L.GridLayer.extend({ } this._map._textInput.showCursor(); - if (this._isFocused /* && !L.Browser.mobile */) { + if (this._map._isFocused /* && !L.Browser.mobile */) { // On mobile, this is causing some key input to get lost. this._map.focus(); } @@ -2132,7 +2130,7 @@ L.TileLayer = L.GridLayer.extend({ _updateCursorAndOverlay: function (/*update*/) { if (this._map._permission === 'edit' && this._isCursorVisible // only when LOK has told us it is ok - && this._isFocused // not when document is not focused + && this._map._isFocused // not when document is not focused && !this._isZooming // not when zooming // && !this.isGraphicVisible() // not when sizing / positioning graphics && !this._isEmptyRectangle(this._visibleCursor)) { diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 3cd72c31c9..1380aade3e 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -114,6 +114,12 @@ L.Map = L.Evented.extend({ this._activeDialog = null; this.showSidebar = false; + // Focusing: + // + // Do we have focus - ie. should we render a cursor + this._isFocused = true; + + vex.dialogID = -1; this.callInitHooks(); @@ -1324,7 +1330,7 @@ L.Map = L.Evented.extend({ var doclayer = this._docLayer; if (doclayer) { - doclayer._isFocused = false; + this._isFocused = false; doclayer._updateCursorAndOverlay(); } @@ -1343,14 +1349,14 @@ L.Map = L.Evented.extend({ _onEditorGotFocus: function() { if (!this._loaded) { return; } - var map = this; var doclayer = this._docLayer; if (doclayer) { - doclayer._isFocused = true; + this._isFocused = true; // we restore the old cursor position by a small delay, so that if the user clicks // inside the document we skip to restore it, so that the user does not see the cursor // jumping from the old position to the new one + var map = this; setTimeout(function () { console.debug('apply focus change in timeout'); map.setWinId(0); |