[Libreoffice-commits] online.git: loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Thu Jun 25 09:25:23 PDT 2015
loleaflet/src/layer/tile/GridLayer.js | 14 +++++++++-----
loleaflet/src/layer/tile/TileLayer.js | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
New commits:
commit 32d6f4fc5f6613a690d8ec80486ff967d6443920
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Thu Jun 25 19:24:45 2015 +0300
Detect document size changes
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index e3f51b5..4a8b5a6 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -359,7 +359,7 @@ L.GridLayer = L.Layer.extend({
this._tileHeightTwips = Math.round(this.options.tileHeightTwips * factor);
},
- _updateMaxBounds: function () {
+ _updateMaxBounds: function (sizeChanged) {
if (this._docWidthTwips === undefined || this._docHeightTwips === undefined) {
return;
}
@@ -367,14 +367,18 @@ L.GridLayer = L.Layer.extend({
this._docHeightTwips / this._tileHeightTwips);
docPixelLimits = docPixelLimits.multiplyBy(this._tileSize);
+ var topLeft = new L.Point(0, 0);
+ topLeft = this._map.unproject(topLeft);
+ var bottomRight = new L.Point(docPixelLimits.x, docPixelLimits.y);
+ bottomRight = this._map.unproject(bottomRight);
+
if (this._documentInfo === '') {
// we just got the first status so we need to center the document
- var topLeft = new L.Point(0, 0);
- topLeft = this._map.unproject(topLeft);
- var bottomRight = new L.Point(docPixelLimits.x, docPixelLimits.y);
- bottomRight = this._map.unproject(bottomRight);
this._map.setMaxBounds(new L.LatLngBounds(topLeft, bottomRight));
}
+ else if (sizeChanged) {
+ 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');
},
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 740948a..3675fdc 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -335,7 +335,7 @@ L.TileLayer = L.GridLayer.extend({
if (command.width && command.height && this._documentInfo !== textMsg) {
this._docWidthTwips = command.width;
this._docHeightTwips = command.height;
- this._updateMaxBounds();
+ this._updateMaxBounds(true);
this._documentInfo = textMsg;
if (this._parts === undefined && command.parts > 1) {
this._map.addControl(L.control.parts({
More information about the Libreoffice-commits
mailing list