Revert "prevent accidental drags"

Not sure this helps a whole lot, and it requires a mousemove listener.

This reverts commit b7760e8747.
This commit is contained in:
John Firebaugh
2013-05-11 15:10:18 -07:00
parent 51cb9af907
commit 271ddace64
+2 -24
View File
@@ -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);
};