Propagate popup clicks outside of map container, close #301

This commit is contained in:
Vladimir Agafonkin 2013-06-24 15:19:15 -04:00
parent 18e3277f8b
commit 5a7420dd1a
2 changed files with 11 additions and 4 deletions

View File

@ -105,7 +105,6 @@ L.DomEvent = {
},
disableClickPropagation: function (el) {
var stop = L.DomEvent.stopPropagation;
for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
@ -113,7 +112,7 @@ L.DomEvent = {
}
return L.DomEvent
.addListener(el, 'click', stop)
.addListener(el, 'click', L.DomEvent._fakeStop)
.addListener(el, 'dblclick', stop);
},
@ -155,6 +154,12 @@ L.DomEvent = {
return delta;
},
_fakeStop: function stop(e) {
// fakes stopPropagation by setting a special event flag checked in Map mouse events handler
// jshint camelcase: false
e._leaflet_stop = true;
},
// check if element really left/entered the event target (for mouseenter/mouseleave)
_checkMouse: function (el, e) {

View File

@ -674,14 +674,16 @@ L.Map = L.Class.extend({
},
_onMouseClick: function (e) {
if (!this._loaded || (this.dragging && this.dragging.moved())) { return; }
// jshint camelcase: false
if (!this._loaded || (this.dragging && this.dragging.moved()) || e._leaflet_stop) { return; }
this.fire('preclick');
this._fireMouseEvent(e);
},
_fireMouseEvent: function (e) {
if (!this._loaded) { return; }
// jshint camelcase: false
if (!this._loaded || e._leaflet_stop) { return; }
var type = e.type;