From 21e4a62e3258b62f8ba5adf04984fffd41e98819 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 9 Dec 2019 15:58:46 +0000 Subject: zoom: while we are in a zoom animation use the target zoom, follow-on. addresses more cases missed by 9afbe35d0d30bbb20d1c2ed62af026d692301194 which affect selection rectangles among other items. Change-Id: Ib4d93f765eb39f7acaa8bbf19a21a910b03e4bb3 --- loleaflet/src/layer/AnnotationManager.js | 2 +- loleaflet/src/map/Map.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 0a7c7a07b..35bb428b2 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -908,7 +908,7 @@ L.AnnotationManager = L.Class.extend({ }, _getScaleFactor: function () { - var scaleFactor = 1.0 / this._map.getZoomScale(this._map.options.zoom, this._map._zoom); + var scaleFactor = 1.0 / this._map.getZoomScale(this._map.options.zoom, this._map.getZoom()); if (scaleFactor < 0.4) scaleFactor = 0.4; else if (scaleFactor < 0.6) diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 908e1f1fc..1a26c4b2e 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -829,12 +829,12 @@ L.Map = L.Evented.extend({ getZoomScale: function (toZoom, fromZoom) { var crs = this.options.crs; - fromZoom = fromZoom === undefined ? this._zoom : fromZoom; + fromZoom = fromZoom === undefined ? this.getZoom() : fromZoom; return crs.scale(toZoom) / crs.scale(fromZoom); }, getScaleZoom: function (scale, fromZoom) { - fromZoom = fromZoom === undefined ? this._zoom : fromZoom; + fromZoom = fromZoom === undefined ? this.getZoom() : fromZoom; return fromZoom + (Math.log(scale) / Math.log(1.2)); }, @@ -842,13 +842,13 @@ L.Map = L.Evented.extend({ // conversion methods project: function (latlng, zoom) { // (LatLng[, Number]) -> Point - zoom = zoom === undefined ? this._zoom : zoom; + zoom = zoom === undefined ? this.getZoom() : zoom; var projectedPoint = this.options.crs.latLngToPoint(L.latLng(latlng), zoom); return new L.Point(L.round(projectedPoint.x, 1e-6), L.round(projectedPoint.y, 1e-6)); }, unproject: function (point, zoom) { // (Point[, Number]) -> LatLng - zoom = zoom === undefined ? this._zoom : zoom; + zoom = zoom === undefined ? this.getZoom() : zoom; return this.options.crs.pointToLatLng(L.point(point), zoom); }, -- cgit v1.2.3