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

Mihai Varga mihai.varga at collabora.com
Fri Jun 26 00:12:20 PDT 2015


 loleaflet/src/layer/tile/GridLayer.js |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 3dffe1ed624657bca5dd93a953c6485d35c5e9e0
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Fri Jun 26 10:11:57 2015 +0300

    This should handle doc resize caused by page deletion

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 4a8b5a6..64e3054 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -363,8 +363,8 @@ L.GridLayer = L.Layer.extend({
 		if (this._docWidthTwips === undefined || this._docHeightTwips === undefined) {
 			return;
 		}
-		var docPixelLimits = new L.Point(this._docWidthTwips / this._tileWidthTwips,
-										 this._docHeightTwips / this._tileHeightTwips);
+		var docPixelLimits = new L.Point(this._docWidthTwips / this.options.tileWidthTwips,
+										 this._docHeightTwips / this.options.tileHeightTwips);
 		docPixelLimits = docPixelLimits.multiplyBy(this._tileSize);
 
 		var topLeft = new L.Point(0, 0);
@@ -377,10 +377,17 @@ L.GridLayer = L.Layer.extend({
 			this._map.setMaxBounds(new L.LatLngBounds(topLeft, bottomRight));
 		}
 		else if (sizeChanged) {
+			// we just update the bounds without panning into the new bounds,
+			// the scrollbars should handle that
 			this._map.options.maxBounds = new L.LatLngBounds(topLeft, bottomRight);
 		}
-		L.DomUtil.setStyle(this._map._mockDoc, 'width', docPixelLimits.x + 'px');
-		L.DomUtil.setStyle(this._map._mockDoc, 'height', docPixelLimits.y + 'px');
+
+		var scrollPixelLimits = new L.Point(this._docWidthTwips / this._tileWidthTwips,
+										 this._docHeightTwips / this._tileHeightTwips);
+		scrollPixelLimits = scrollPixelLimits.multiplyBy(this._tileSize);
+
+		L.DomUtil.setStyle(this._map._mockDoc, 'width', scrollPixelLimits.x + 'px');
+		L.DomUtil.setStyle(this._map._mockDoc, 'height', scrollPixelLimits.y + 'px');
 	},
 
 	_updateScrollOffset: function () {


More information about the Libreoffice-commits mailing list