[Libreoffice-commits] online.git: loleaflet/src
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Fri Jan 15 05:16:40 PST 2016
loleaflet/src/layer/tile/CalcTileLayer.js | 18 ++++++++++--------
loleaflet/src/layer/tile/ImpressTileLayer.js | 18 ++++++++++--------
loleaflet/src/layer/tile/TileLayer.js | 2 ++
loleaflet/src/layer/tile/WriterTileLayer.js | 18 ++++++++++--------
4 files changed, 32 insertions(+), 24 deletions(-)
New commits:
commit 033a066ba7f76034008042d391f87607fff5a66c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Jan 14 16:55:50 2016 +0100
Don't send unneccesary "tilecombine" on multiple invalidates
It usually happens that we get more "invalidateTiles" requests
from LO for one change. To avoid unnecessary tile rerenders we
remember (in transientInvalidationKeys) all tile keys which we
send to the server for rerendering and don't send the request
for the same tile. This is effective until we get back a
rerendered tile from the server (transientInvalidationKeys is
cleared).
(cherry picked from commit fdd76332db6b9c3b59864132578dc01ce19f0214)
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 6ee5cb3..7145004 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -48,14 +48,16 @@ L.CalcTileLayer = L.TileLayer.extend({
this._tiles[key]._invalidCount = 1;
}
if (visibleArea.intersects(bounds)) {
- if (tilePositionsX !== "")
- tilePositionsX += ',';
- tilePositionsX += tileTopLeft.x;
-
- if (tilePositionsY !== "")
- tilePositionsY += ',';
- tilePositionsY += tileTopLeft.y;
- needsNewTiles = true;
+ if (!this._transientInvalidationKeys[key]) {
+ if (tilePositionsX !== "")
+ tilePositionsX += ',';
+ tilePositionsX += tileTopLeft.x;
+ if (tilePositionsY !== "")
+ tilePositionsY += ',';
+ tilePositionsY += tileTopLeft.y;
+ needsNewTiles = true;
+ this._transientInvalidationKeys[key] = true;
+ }
}
else {
// tile outside of the visible area, just remove it
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 3e76cbe..345afa9 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -39,14 +39,16 @@ L.ImpressTileLayer = L.TileLayer.extend({
this._tiles[key]._invalidCount = 1;
}
if (visibleArea.intersects(bounds)) {
- if (tilePositionsX !== "")
- tilePositionsX += ',';
- tilePositionsX += tileTopLeft.x;
-
- if (tilePositionsY !== "")
- tilePositionsY += ',';
- tilePositionsY += tileTopLeft.y;
- needsNewTiles = true;
+ if (!this._transientInvalidationKeys[key]) {
+ if (tilePositionsX !== "")
+ tilePositionsX += ',';
+ tilePositionsX += tileTopLeft.x;
+ if (tilePositionsY !== "")
+ tilePositionsY += ',';
+ tilePositionsY += tileTopLeft.y;
+ needsNewTiles = true;
+ this._transientInvalidationKeys[key] = true;
+ }
}
else {
// tile outside of the visible area, just remove it
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index ee1df4a..c868b8e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -113,6 +113,7 @@ L.TileLayer = L.GridLayer.extend({
this._levels = {};
this._tiles = {};
this._tileCache = {};
+ this._transientInvalidationKeys = {};
map._fadeAnimated = false;
this._viewReset();
@@ -601,6 +602,7 @@ L.TileLayer = L.GridLayer.extend({
},
_onTileMsg: function (textMsg, img) {
+ this._transientInvalidationKeys = {};
var command = this._map._socket.parseServerCmd(textMsg);
var coords = this._twipsToCoords(command);
coords.z = command.zoom;
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 3c0ad8f..ed9f81c 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -40,14 +40,16 @@ L.WriterTileLayer = L.TileLayer.extend({
this._tiles[key]._invalidCount = 1;
}
if (visibleArea.intersects(bounds)) {
- if (tilePositionsX !== "")
- tilePositionsX += ',';
- tilePositionsX += tileTopLeft.x;
-
- if (tilePositionsY !== "")
- tilePositionsY += ',';
- tilePositionsY += tileTopLeft.y;
- needsNewTiles = true;
+ if (!this._transientInvalidationKeys[key]) {
+ if (tilePositionsX !== "")
+ tilePositionsX += ',';
+ tilePositionsX += tileTopLeft.x;
+ if (tilePositionsY !== "")
+ tilePositionsY += ',';
+ tilePositionsY += tileTopLeft.y;
+ needsNewTiles = true;
+ this._transientInvalidationKeys[key] = true;
+ }
}
else {
// tile outside of the visible area, just remove it
More information about the Libreoffice-commits
mailing list