[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/src

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Thu Jan 14 08:23:08 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 fdd76332db6b9c3b59864132578dc01ce19f0214
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).

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 8196c23..b09e2bb 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 de3cf4f..302f286 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 04fe59c..3a88565 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();
@@ -590,6 +591,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