Skip to content

Commit

Permalink
map zoom blclick
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocudini committed Apr 26, 2019
1 parent 64b7043 commit 03146fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/core/client/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Kepler.Map = {
minZoom: self.options.minZoom,
maxBounds: self.options.maxBounds,
attributionControl: false,
doubleClickZoom: false,
doubleClickZoom: true,
zoomControl: false
});

Expand Down
11 changes: 4 additions & 7 deletions packages/lib/client/L.Cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ L.Cursor = L.Layer.extend({

options: {
className: 'leaflet-div-icon',
event: 'click'
},

initialize: function(options) {
Expand All @@ -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() {
Expand Down

0 comments on commit 03146fd

Please sign in to comment.