loleaflet/src/core/Socket.js | 4 +++- loleaflet/src/layer/tile/GridLayer.js | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-)
New commits: commit 8af096eb634d17c6937ff33fc4361c95d5e92fd5 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Sep 5 13:20:56 2018 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Sep 5 13:20:56 2018 +0200 Reset client visible area members by connection lost / reloading Change-Id: I28eb32d7c667a1a2b71de4bfcb348f5fab020123 diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 1208e6e75..6eaeace1b 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -518,6 +518,7 @@ L.Socket = L.Class.extend({ if (this._map._docLayer) { this._map._docLayer.removeAllViews(); + this._map._docLayer._resetClientVisArea(); } this.close(); @@ -761,7 +762,7 @@ L.Socket = L.Class.extend({ else if (this._reconnecting) { // we are reconnecting ... this._reconnecting = false; - this._map._docLayer.viewReset(); + this._map._docLayer._resetClientVisArea(); this._map._docLayer._onMessage('invalidatetiles: EMPTY', null); this._map.fire('statusindicator', {statusType: 'reconnected'}); this._map.setPermission(this._map.options.permission); @@ -805,6 +806,7 @@ L.Socket = L.Class.extend({ if (this._map._docLayer) { this._map._docLayer.removeAllViews(); + this._map._docLayer._resetClientVisArea(); } if (isActive && this._reconnecting) { diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js index ca4103077..f02f00912 100644 --- a/loleaflet/src/layer/tile/GridLayer.js +++ b/loleaflet/src/layer/tile/GridLayer.js @@ -334,6 +334,7 @@ L.GridLayer = L.Layer.extend({ tileZoomChanged = this._tileZoom !== tileZoom; if (!noUpdate && (hard || tileZoomChanged)) { + this._resetClientVisArea(); if (this._abortLoading) { this._abortLoading(); @@ -359,6 +360,11 @@ L.GridLayer = L.Layer.extend({ this._setZoomTransforms(center, zoom); }, + _resetClientVisArea: function () { + this._clientZoom = ''; + this._clientVisibleArea = ''; + }, + _updateTileTwips: function () { // smaller zoom = zoom in var factor = Math.pow(1.2, (this._map.options.zoom - this._tileZoom)); @@ -542,9 +548,9 @@ L.GridLayer = L.Layer.extend({ } } - this._sendClientVisibleArea(); + this._sendClientVisibleArea(true); - this._sendClientZoom(); + this._sendClientZoom(true); if (queue.length !== 0) { if (newView) { @@ -692,7 +698,7 @@ L.GridLayer = L.Layer.extend({ } }, - _sendClientVisibleArea: function () { + _sendClientVisibleArea: function (forceUpdate) { var visibleTopLeft = this._latLngToTwips(this._map.getBounds().getNorthWest()); var visibleBottomRight = this._latLngToTwips(this._map.getBounds().getSouthEast()); var visibleArea = new L.Bounds(visibleTopLeft, visibleBottomRight); @@ -700,10 +706,11 @@ L.GridLayer = L.Layer.extend({ var newClientVisibleArea = 'clientvisiblearea x=' + Math.round(visibleTopLeft.x) + ' y=' + Math.round(visibleTopLeft.y) + ' width=' + Math.round(size.x) + ' height=' + Math.round(size.y); - if (this._clientVisibleArea !== newClientVisibleArea) { + if (this._clientVisibleArea !== newClientVisibleArea || forceUpdate) { // Visible area is dirty, update it on the server - this._clientVisibleArea = newClientVisibleArea - this._map._socket.sendMessage(this._clientVisibleArea); + this._map._socket.sendMessage(newClientVisibleArea); + if (!this._map._fatal && this._map._active && this._map._socket.connected()) + this._clientVisibleArea = newClientVisibleArea if (this._debug) { this._debugInfo.clearLayers(); for (var key in this._tiles) { @@ -714,16 +721,19 @@ L.GridLayer = L.Layer.extend({ } }, - _sendClientZoom: function () { + _sendClientZoom: function (forceUpdate) { + var newClientZoom = 'tilepixelwidth=' + this._tileWidthPx + ' ' + 'tilepixelheight=' + this._tileHeightPx + ' ' + 'tiletwipwidth=' + this._tileWidthTwips + ' ' + 'tiletwipheight=' + this._tileHeightTwips; - if (this._clientZoom !== newClientZoom) { + if (this._clientZoom !== newClientZoom || forceUpdate) { // the zoom level has changed - this._clientZoom = newClientZoom; - this._map._socket.sendMessage('clientzoom ' + this._clientZoom); + this._map._socket.sendMessage('clientzoom ' + newClientZoom); + + if (!this._map._fatal && this._map._active && this._map._socket.connected()) + this._clientZoom = newClientZoom; } }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits