[Libreoffice-commits] online.git: loleaflet/src

Mihai Varga mihai.varga at collabora.com
Thu Jul 16 06:52:05 PDT 2015


 loleaflet/src/layer/tile/GridLayer.js |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit fe06836afb1e710f8b9105ab2921f660713ae409
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Jul 16 16:51:44 2015 +0300

    loleaflet: prefetch fewer tiles in while editing

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 3016a78..f59a15d 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -795,6 +795,12 @@ L.GridLayer = L.Layer.extend({
 		}
 		var center = map.getCenter();
 		var zoom = map.getZoom();
+		var tilesToFetch = 10;
+		var maxBorderWidth = 5;
+		if (this._premission === 'edit') {
+			tilesToFetch = 2;
+			maxBorderWidth = 2;
+		}
 
 		if (!this._preFetchBorder) {
 			var pixelBounds = map.getPixelBounds(center, zoom),
@@ -807,14 +813,13 @@ L.GridLayer = L.Layer.extend({
 		var queue = [],
 			finalQueue = [],
 			visitedTiles = {},
-			tilesToFetch = 10,
 			borderWidth = 0;
 			// don't search on a border wider than 5 tiles because it will freeze the UI
 
 		while ((tileBorder.min.x >= 0 || tileBorder.min.y >= 0 ||
 				tileBorder.max.x * this._tileWidthTwips < this._docWidthTwips ||
 				 tileBorder.max.y * this._tileHeightTwips < this._docHeightTwips) &&
-				tilesToFetch > 0 && borderWidth < 5) {
+				tilesToFetch > 0 && borderWidth < maxBorderWidth) {
 			// while the bounds do not fully contain the document
 
 			for (var i = tileBorder.min.x; i <= tileBorder.max.x; i++) {


More information about the Libreoffice-commits mailing list