loleaflet/src/layer/tile/CalcTileLayer.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
New commits: commit ba62d824ea7bd4cc262c83d4298c5b9d2d776978 Author: Henry Castro <hcas...@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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits