move closePopupOnClick to Map
This commit is contained in:
parent
ba8c690751
commit
d6dc8acd04
@ -3,8 +3,7 @@ L.Popup = L.Class.extend({
|
||||
includes: L.Mixin.Events,
|
||||
|
||||
options: {
|
||||
maxWidth: 300,
|
||||
closeOnClick: true
|
||||
maxWidth: 300
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
@ -23,11 +22,6 @@ L.Popup = L.Class.extend({
|
||||
|
||||
map.on('viewreset', this._updatePosition, this);
|
||||
|
||||
if (this.options.closeOnClick) {
|
||||
map.on('click', map.closePopup, map);
|
||||
//TODO move closeOnClick to Map
|
||||
}
|
||||
|
||||
this._container.style.visibility = 'hidden';
|
||||
this._updateLayout();
|
||||
this._updatePosition();
|
||||
|
@ -3,6 +3,10 @@ L.Map.include({
|
||||
openPopup: function(latlng, content, offset) {
|
||||
if (!this._popup) {
|
||||
this._popup = new L.Popup();
|
||||
|
||||
if (this.options.closePopupOnClick) {
|
||||
this.on('click', this.closePopup, this);
|
||||
}
|
||||
} else {
|
||||
this.removeLayer(this._popup);
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ L.Map = L.Class.extend({
|
||||
doubleClickZoom: true,
|
||||
|
||||
//misc
|
||||
trackResize: true
|
||||
trackResize: true,
|
||||
closePopupOnClick: true
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user