IE10 - fix of not simulating clicks even when drag was within TAP_TOLERANCE

(cherry picked from commit b7e84aed9b77c51e2a4698251bf38ccf46b82dc7)
This commit is contained in:
Marcel Sulek 2012-10-13 14:03:03 +02:00 committed by danzel
parent fc3a36d39c
commit ba22cc28b2

View File

@ -105,6 +105,7 @@ L.Draggable = L.Class.extend({
}, },
_onUp: function (e) { _onUp: function (e) {
var moved = this._moved;
if (this._simulateClick && e.changedTouches) { if (this._simulateClick && e.changedTouches) {
var first = e.changedTouches[0], var first = e.changedTouches[0],
el = first.target, el = first.target,
@ -115,6 +116,7 @@ L.Draggable = L.Class.extend({
} }
if (dist < L.Draggable.TAP_TOLERANCE) { if (dist < L.Draggable.TAP_TOLERANCE) {
this._moved = false;
this._simulateEvent('click', first); this._simulateEvent('click', first);
} }
} }
@ -127,7 +129,7 @@ L.Draggable = L.Class.extend({
L.DomEvent.off(document, L.Draggable.MOVE, this._onMove); L.DomEvent.off(document, L.Draggable.MOVE, this._onMove);
L.DomEvent.off(document, L.Draggable.END, this._onUp); L.DomEvent.off(document, L.Draggable.END, this._onUp);
if (this._moved) { if (moved) {
// ensure drag is not fired after dragend // ensure drag is not fired after dragend
L.Util.cancelAnimFrame(this._animRequest); L.Util.cancelAnimFrame(this._animRequest);