From 5f960721d9f3267e8cb4b77571238b59e449aa1b Mon Sep 17 00:00:00 2001 From: danzel Date: Wed, 31 Oct 2012 13:11:16 +1300 Subject: [PATCH] Use L.Util.bind instead of var self. --- src/dom/Draggable.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/dom/Draggable.js b/src/dom/Draggable.js index 5e5fc671..426cc2cb 100644 --- a/src/dom/Draggable.js +++ b/src/dom/Draggable.js @@ -69,16 +69,15 @@ L.Draggable = L.Class.extend({ //Touch contextmenu event emulation if (e.touches && e.touches.length === 1 && L.Browser.touch && this._longPress) { - var self = this; - this._contextMenuTimeout = setTimeout(function () { - var dist = (self._newPos && self._newPos.distanceTo(self._startPos)) || 0; + this._contextMenuTimeout = setTimeout(L.Util.bind(function () { + var dist = (this._newPos && this._newPos.distanceTo(this._startPos)) || 0; if (dist < L.Draggable.TAP_TOLERANCE) { - self._simulateClick = false; - self._onUp(); - self._simulateEvent('contextmenu', first); + this._simulateClick = false; + this._onUp(); + this._simulateEvent('contextmenu', first); } - }, 1000); + }, this), 1000); } L.DomEvent.on(document, L.Draggable.MOVE, this._onMove, this);