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

Henry Castro hcastro at collabora.com
Sat Jan 16 12:56:40 PST 2016


 loleaflet/src/layer/tile/CalcTileLayer.js |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 3cbaded0d2c7a687f81f3feea318b870a72f7ba2
Author: Henry Castro <hcastro at collabora.com>
Date:   Sat Jan 16 16:50:31 2016 -0400

    loleaflet: adjust document size to map size

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index d45d9b9..0d8167e 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -149,10 +149,24 @@ L.CalcTileLayer = L.TileLayer.extend({
 			this._docWidthTwips = command.width;
 			this._docHeightTwips = command.height;
 			this._docType = command.type;
-			this._updateMaxBounds(true);
-			this._documentInfo = textMsg;
 			this._parts = command.parts;
 			this._selectedPart = command.selectedPart;
+			var mapSize = this._map.getSize();
+			var width = this._docWidthTwips / this._tileWidthTwips * this._tileSize;
+			var height = this._docHeightTwips / this._tileHeightTwips * this._tileSize;
+			if (width < mapSize.x || height < mapSize.y) {
+				width = Math.max(width, mapSize.x);
+				height = Math.max(height, mapSize.y);
+				var topLeft = this._map.unproject(new L.Point(0, 0));
+				var bottomRight = this._map.unproject(new L.Point(width, height));
+				this._map.setMaxBounds(new L.LatLngBounds(topLeft, bottomRight));
+				this._docPixelSize = {x: width, y: height};
+				this._map.fire('docsize', {x: width, y: height});
+			}
+			else {
+				this._updateMaxBounds(true);
+			}
+			this._documentInfo = textMsg;
 			this._map._socket.sendMessage('setclientpart part=' + this._selectedPart);
 			var partNames = textMsg.match(/[^\r\n]+/g);
 			// only get the last matches


More information about the Libreoffice-commits mailing list