loleaflet/src/layer/tile/WriterTileLayer.js | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-)
New commits: commit 8a2c2ad91d3c8b66a8454c97543c97c0f3e3730a Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Nov 20 14:15:12 2016 +0530 loleaflet: Don't unnecessarily update map bounds This leads to emission of 'docsize' event somewhere down the line which leads inconsistencies while navigating the document. Change-Id: Iffabac66153e7b32c9b2af041282ef82b813bef3 diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js index 3b34125..7b93b23 100644 --- a/loleaflet/src/layer/tile/WriterTileLayer.js +++ b/loleaflet/src/layer/tile/WriterTileLayer.js @@ -120,24 +120,29 @@ L.WriterTileLayer = L.TileLayer.extend({ _onStatusMsg: function (textMsg) { var command = this._map._socket.parseServerCmd(textMsg); - if (command.width && command.height && this._documentInfo !== textMsg) { + if (!command.width || !command.height || this._documentInfo === textMsg) + return; + + var sizeChanged = command.width !== this._docWidthTwips || command.height !== this._docHeightTwips; + if (sizeChanged) { this._docWidthTwips = command.width; this._docHeightTwips = command.height; this._docType = command.type; - this._updateMaxBounds(true); - this._documentInfo = textMsg; - this._selectedPart = 0; - this._parts = 1; - this._currentPage = command.selectedPart; - this._pages = command.parts; this._viewId = parseInt(command.viewid); - this._map.fire('pagenumberchanged', { - currentPage: this._currentPage, - pages: this._pages, - docType: this._docType - }); - this._resetPreFetching(true); - this._update(); + this._updateMaxBounds(true); } + + this._documentInfo = textMsg; + this._selectedPart = 0; + this._parts = 1; + this._currentPage = command.selectedPart; + this._pages = command.parts; + this._map.fire('pagenumberchanged', { + currentPage: this._currentPage, + pages: this._pages, + docType: this._docType + }); + this._resetPreFetching(true); + this._update(); } }); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits