export force.drag instance so user can access it by calling force.drag()... #799

Closed
wants to merge 1 commit into
from

Conversation

2 participants
Contributor

GerHobbelt commented Sep 5, 2012

... with no arguments; the drag events have been namespaced as .force, similar to the other force events: mouseover.force and mouseout.force.

It is very useful for the user to be able to get access to the force layout's drag instance, so we can override/augment the drag behaviour easily (using namespaced events, f.e.); again http://bl.ocks.org/3616279 is one case where such ability is used to add a kind of 'pinning' behaviour for dragged nodes when SHIFT/CTRL has been pressed on mouse release.

The way this 'drag' instance reference is obtained is in line with other D3 functions, where calling it with no arguments returns the drag instance. (The documented use of drag via selection.call() happens to always call it with arguments, so that pans out nicely here :-) )

export force.drag instance so user can access it by calling force.dra…
…g() with no arguments; the drag events have been namespaced as <event>.force, similar to the other force events: mouseover.force and mouseout.force.
Owner

mbostock commented Jan 23, 2013

Yes.

Owner

mbostock commented Feb 6, 2013

Folded into #1062.

@mbostock mbostock closed this Feb 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment