Skip to content
Permalink
Browse files

Propagate popup clicks outside of map container, close #301

  • Loading branch information...
mourner committed Jun 24, 2013
1 parent 18e3277 commit 5a7420dd1a43474cccaa8cdefa4f324452d18f36
Showing with 11 additions and 4 deletions.
  1. +7 −2 src/dom/DomEvent.js
  2. +4 −2 src/map/Map.js
@@ -105,15 +105,14 @@ L.DomEvent = {
},

disableClickPropagation: function (el) {

var stop = L.DomEvent.stopPropagation;

for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
L.DomEvent.addListener(el, L.Draggable.START[i], stop);
}

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) {

@@ -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;

0 comments on commit 5a7420d

Please sign in to comment.
You can’t perform that action at this time.