loleaflet: fix fitWidthZoom inconsistency
Change-Id: I511112d05de2b2734d7d2b2f905a3ba797dcca5f
This commit is contained in:
parent
07a3b6994e
commit
f3778421b1
1 changed files with 8 additions and 8 deletions
|
@ -938,17 +938,17 @@ L.TileLayer = L.GridLayer.extend({
|
|||
if (this._docType !== 'spreadsheet' || !e) {
|
||||
// If it's not a spreadsheet or the method has been invoked manually
|
||||
var crsScale = this._map.options.crs.scale(1);
|
||||
if (this._docPixelSize.x > size.x) {
|
||||
var ratio = this._docPixelSize.x / size.x;
|
||||
var zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale));
|
||||
this._map.setZoom(Math.max(1, this._map.getZoom() - zoomDelta), {animate: false});
|
||||
}
|
||||
else if (size.x / this._docPixelSize.x > crsScale) {
|
||||
if (size.x / this._docPixelSize.x > crsScale) {
|
||||
// we could zoom in
|
||||
ratio = size.x / this._docPixelSize.x;
|
||||
zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale));
|
||||
var ratio = size.x / this._docPixelSize.x;
|
||||
var zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale));
|
||||
this._map.setZoom(Math.min(maxZoom, this._map.getZoom() + zoomDelta), {animate: false});
|
||||
}
|
||||
if (this._docPixelSize.x > size.x) {
|
||||
ratio = this._docPixelSize.x / size.x;
|
||||
zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale));
|
||||
this._map.setZoom(Math.max(1, this._map.getZoom() - zoomDelta), {animate: false});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue