Don't dispatch drag start and move together

Drag start is responsible for switching into drag mode, classing
stuff as `active` and kicking off a bunch of other things.

If the drag move happens immediately after this, and includes the
target from the initial active drag, it can cause weird snapping
from the dragnode to its own parent way.  (Happened if the user did
a very fast drag from the node along the parent way just next to it)
This commit is contained in:
Bryan Housel
2017-12-22 13:58:27 -05:00
parent be00a526b6
commit fc680545ad
+10 -10
View File
@@ -110,19 +110,19 @@ export function behaviorDrag() {
if (dx === 0 && dy === 0)
return;
if (!started) {
started = true;
_event({ type: 'start' });
}
startOrigin = p;
d3_eventCancel();
_event({
type: 'move',
point: [p[0] + offset[0], p[1] + offset[1]],
delta: [dx, dy]
});
if (!started) {
started = true;
_event({ type: 'start' });
} else {
_event({
type: 'move',
point: [p[0] + offset[0], p[1] + offset[1]],
delta: [dx, dy]
});
}
}