fix contextmenu event on path layers

This commit is contained in:
Vladimir Agafonkin 2012-07-13 14:48:35 +03:00
parent c28036f2c8
commit ad4b8a2441
2 changed files with 8 additions and 7 deletions

View File

@ -26,16 +26,16 @@
styleId: 997
}).addTo(map);
L.marker([51.5, -0.09])
var marker = L.marker([51.5, -0.09])
.bindPopup("<b>Hello world!</b><br />I am a popup.")
.addTo(map)
.openPopup();
L.circle([51.508, -0.11], 500, {color: '#f03', opacity: 0.7})
var circle = L.circle([51.508, -0.11], 500, {color: '#f03', opacity: 0.7})
.bindPopup("I am a circle.")
.addTo(map);
L.polygon([
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]])

View File

@ -100,10 +100,6 @@ L.Path = L.Path.extend({
return;
}
if (e.type === 'contextmenu') {
L.DomEvent.preventDefault(e);
}
this._fireMouseEvent(e);
},
@ -111,6 +107,11 @@ L.Path = L.Path.extend({
if (!this.hasEventListeners(e.type)) {
return;
}
if (e.type === 'contextmenu') {
L.DomEvent.preventDefault(e);
}
var map = this._map,
containerPoint = map.mouseEventToContainerPoint(e),
layerPoint = map.containerPointToLayerPoint(containerPoint),