Fixed regression in Draggable (click triggers after dragging), closed #306

This commit is contained in:
mourner 2011-09-23 17:03:36 +03:00
parent 106054140b
commit fe443d3d50

View File

@ -43,7 +43,8 @@ L.Draggable = L.Class.extend({
el.className += ' leaflet-active'; el.className += ' leaflet-active';
} }
if (this._moved) { return; } this._moved = false;
if (this._moving) { return; }
if (!L.Browser.touch) { if (!L.Browser.touch) {
L.DomUtil.disableTextSelection(); L.DomUtil.disableTextSelection();
@ -68,6 +69,7 @@ L.Draggable = L.Class.extend({
this.fire('dragstart'); this.fire('dragstart');
this._moved = true; this._moved = true;
} }
this._moving = true;
var newPoint = new L.Point(first.clientX, first.clientY); var newPoint = new L.Point(first.clientX, first.clientY);
this._newPos = this._startPos.add(newPoint).subtract(this._startPoint); this._newPos = this._startPos.add(newPoint).subtract(this._startPoint);
@ -106,8 +108,8 @@ L.Draggable = L.Class.extend({
if (this._moved) { if (this._moved) {
this.fire('dragend'); this.fire('dragend');
this._moved = false;
} }
this._moving = false;
}, },
_setMovingCursor: function() { _setMovingCursor: function() {