#2865, fixed bug with geometry/staticMarker click event after map dragging

This commit is contained in:
AndreyGeonya 2014-08-23 01:00:42 +03:00
parent 641cb18923
commit 18938b0319
2 changed files with 13 additions and 1 deletions

View File

@ -38,13 +38,24 @@
map.addLayer(markerDraggable); map.addLayer(markerDraggable);
markerDraggable.bindPopup("Draggable"); markerDraggable.bindPopup("Draggable");
var poly = new L.Polygon([[0, 10], [0, 15.5], [0, 50], [20, 20.5]]);
map.addLayer(poly);
markerDraggable.on('click', function(e) { markerDraggable.on('click', function(e) {
console.log('markerDraggable click'); console.log('markerDraggable click');
}); });
markerStatic.on('click', function(e) {
console.log('markerStatic click');
})
map.on('click', function(e) { map.on('click', function(e) {
console.log('map click'); console.log('map click');
}); });
poly.on('click', function(e) {
console.log('poly click');
});
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
attribution: "Map: Tiles Courtesy of MapQuest (OpenStreetMap, CC-BY-SA)", attribution: "Map: Tiles Courtesy of MapQuest (OpenStreetMap, CC-BY-SA)",

View File

@ -571,7 +571,8 @@ L.Map = L.Evented.extend({
if (L.DomEvent._skipped(e)) { return; } if (L.DomEvent._skipped(e)) { return; }
if (type === 'click') { if (type === 'click') {
if (!e._simulated && ((obj.dragging && obj.dragging.moved()) || var draggableObj = obj.options.draggable === true ? obj : this;
if (!e._simulated && ((draggableObj.dragging && draggableObj.dragging.moved()) ||
(this.boxZoom && this.boxZoom.moved()))) { return; } (this.boxZoom && this.boxZoom.moved()))) { return; }
obj.fire('preclick'); obj.fire('preclick');
} }