]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/assets/leaflet/leaflet.js
Recenter marker on map pan/zoom
[rails.git] / vendor / assets / leaflet / leaflet.js
index 794496b35130fb5121ef764b3947b33187787ff5..17fbc626bb6ee31558e28885711b3801eaeb34dc 100644 (file)
@@ -6765,15 +6765,22 @@ L.Map.mergeOptions({
 
 L.Map.DoubleClickZoom = L.Handler.extend({
        addHooks: function () {
 
 L.Map.DoubleClickZoom = L.Handler.extend({
        addHooks: function () {
-               this._map.on('dblclick', this._onDoubleClick);
+               this._map.on('dblclick', this._onDoubleClick, this);
        },
 
        removeHooks: function () {
        },
 
        removeHooks: function () {
-               this._map.off('dblclick', this._onDoubleClick);
+               this._map.off('dblclick', this._onDoubleClick, this);
        },
 
        _onDoubleClick: function (e) {
        },
 
        _onDoubleClick: function (e) {
-               this.setZoomAround(e.containerPoint, this._zoom + 1);
+               var map = this._map,
+                   zoom = map.getZoom() + 1;
+
+               if (map.options.doubleClickZoom === 'center') {
+                       map.setZoom(zoom);
+               } else {
+                       map.setZoomAround(e.containerPoint, zoom);
+               }
        }
 });
 
        }
 });
 
@@ -6833,7 +6840,11 @@ L.Map.ScrollWheelZoom = L.Handler.extend({
 
                if (!delta) { return; }
 
 
                if (!delta) { return; }
 
-               map.setZoomAround(this._lastMousePos, zoom + delta);
+               if (map.options.scrollWheelZoom === 'center') {
+                       map.setZoom(zoom + delta);
+               } else {
+                       map.setZoomAround(this._lastMousePos, zoom + delta);
+               }
        }
 });
 
        }
 });