From 271ddace64c5f419a9528123533822c9c1d8c090 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sat, 11 May 2013 15:10:18 -0700 Subject: [PATCH] Revert "prevent accidental drags" Not sure this helps a whole lot, and it requires a mousemove listener. This reverts commit b7760e87473d54fed9ff8e34a3963a944f75b945. --- js/id/behavior/drag.js | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/js/id/behavior/drag.js b/js/id/behavior/drag.js index 032c1ac8c..37c3c5ddc 100644 --- a/js/id/behavior/drag.js +++ b/js/id/behavior/drag.js @@ -111,30 +111,12 @@ iD.behavior.drag = function() { } } - var lastPos = [[0, 0], [0, 0]], - lastTimes = [0, 0]; - - function move() { - lastPos.push([d3.event.clientX, d3.event.clientY]); - lastTimes.push((new Date()).getTime()); - lastTimes.shift(); - lastPos.shift(); - } - function drag(selection) { var matchesSelector = iD.util.prefixDOMProperty('matchesSelector'), delegate = mousedown; if (selector) { delegate = function() { - - var velocity = Math.sqrt( - Math.pow(lastPos[0][0] - d3.event.clientX, 2), - Math.pow(lastPos[0][1] - d3.event.clientY, 2)) / - ((new Date()).getTime() - lastTimes[0]); - - if (velocity > 0.05) return; - var root = this, target = d3.event.target; for (; target && target !== root; target = target.parentNode) { @@ -146,16 +128,12 @@ iD.behavior.drag = function() { }; } - selection - .on("mousemove.drag" + selector, move) - .on("mousedown.drag" + selector, delegate) + selection.on("mousedown.drag" + selector, delegate) .on("touchstart.drag" + selector, delegate); } drag.off = function(selection) { - selection - .on("mousemove.drag" + selector, null) - .on("mousedown.drag" + selector, null) + selection.on("mousedown.drag" + selector, null) .on("touchstart.drag" + selector, null); };