Use L.Util.bind instead of var self.
This commit is contained in:
parent
3aeff55f24
commit
5f960721d9
@ -69,16 +69,15 @@ L.Draggable = L.Class.extend({
|
|||||||
|
|
||||||
//Touch contextmenu event emulation
|
//Touch contextmenu event emulation
|
||||||
if (e.touches && e.touches.length === 1 && L.Browser.touch && this._longPress) {
|
if (e.touches && e.touches.length === 1 && L.Browser.touch && this._longPress) {
|
||||||
var self = this;
|
this._contextMenuTimeout = setTimeout(L.Util.bind(function () {
|
||||||
this._contextMenuTimeout = setTimeout(function () {
|
var dist = (this._newPos && this._newPos.distanceTo(this._startPos)) || 0;
|
||||||
var dist = (self._newPos && self._newPos.distanceTo(self._startPos)) || 0;
|
|
||||||
|
|
||||||
if (dist < L.Draggable.TAP_TOLERANCE) {
|
if (dist < L.Draggable.TAP_TOLERANCE) {
|
||||||
self._simulateClick = false;
|
this._simulateClick = false;
|
||||||
self._onUp();
|
this._onUp();
|
||||||
self._simulateEvent('contextmenu', first);
|
this._simulateEvent('contextmenu', first);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, this), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
L.DomEvent.on(document, L.Draggable.MOVE, this._onMove, this);
|
L.DomEvent.on(document, L.Draggable.MOVE, this._onMove, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user