From 03146fdb5974369ab917e3dce2c8d3e51ad86f73 Mon Sep 17 00:00:00 2001 From: stefanocudini Date: Fri, 26 Apr 2019 16:29:22 +0200 Subject: [PATCH] map zoom blclick --- CHANGELOG.md | 1 + packages/core/client/Map.js | 2 +- packages/lib/client/L.Cursor.js | 11 ++++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6f4816..2e311e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - plugin admin button in place panel - plugin admin move urls under /admin - plugin convers move autoresize lib in core lib +- map zoom dblclick ## v1.6.4 - fix map markers glich diff --git a/packages/core/client/Map.js b/packages/core/client/Map.js index 0dc22784..afd0ffcf 100755 --- a/packages/core/client/Map.js +++ b/packages/core/client/Map.js @@ -61,7 +61,7 @@ Kepler.Map = { minZoom: self.options.minZoom, maxBounds: self.options.maxBounds, attributionControl: false, - doubleClickZoom: false, + doubleClickZoom: true, zoomControl: false }); diff --git a/packages/lib/client/L.Cursor.js b/packages/lib/client/L.Cursor.js index 3db84a80..ecd42511 100644 --- a/packages/lib/client/L.Cursor.js +++ b/packages/lib/client/L.Cursor.js @@ -5,6 +5,7 @@ L.Cursor = L.Layer.extend({ options: { className: 'leaflet-div-icon', + event: 'click' }, initialize: function(options) { @@ -21,22 +22,18 @@ L.Cursor = L.Layer.extend({ }, onAdd: function(map) { this._map = map; - this._map.on('click', this._onSwitch, this); - this._map.on('dblclick', this._onSwitch, this); + this._map.on(this.options.event, this._onSwitch, this); }, onRemove: function(map) { - map.off('click', this._onSwitch, this); - map.off('dblclick', this._onSwitch, this); + map.off(this.options.event, this._onSwitch, this); map.removeLayer(this.marker); }, _onSwitch: function(e) { + if(this._map.hasLayer(this.marker)) this.hide(); else this.setLoc(e.latlng); - - if(e.type==='dblclick') - this.marker.openPopup(); }, hide: function() {