javascript - Manually restarting d3 drag -
i'm trying use 2 separate drag behaviours depending on whether node held on second, or dragged immediately. i'm identifying hold behaviour enough using timer mouseup , mousedown , storing in "nodeheld" variable. run issues applying drag...
if use "d3.event.sourceevent.stoppropagation();" on dragstart, enables single node dragged on it's own. if omit stoppropagation line, other drag listener (on canvas) ensures nodes dragged though i'm clicking on 1 specifically. wanted use "nodeheld" variable determine whether or not drag nodes, or specific one...
var drag = force.stop().drag() .on("drag", function(d) { if (nodeheld) { d3.event.sourceevent.stoppropagation(); //this doesn't seem unless it's included @ dragstart } }) .on("dragstart", function(d) { //d3.event.sourceevent.stoppropagation(); //with above commented out, drag on node drags nodes //i can't use "nodeheld" check here either, because takes //a second or become "true" (by point drag has started) });
as describe in comments above, seems stoppropagation work on dragstart (which me whether node has been held or not).
so i'm hoping there's way me restart drag behaviour after i've calculated node being held, can add "if (nodeheld) ..." check dragstart.
thanks thoughts @ all!
Comments
Post a Comment