Skip to content

Commit fffbb81

Browse files
committed
export force.drag instance so user can access it by calling force.drag() with no arguments; the drag events have been namespaced as <event>.force, similar to the other force events: mouseover.force and mouseout.force.
1 parent 39347b4 commit fffbb81

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/layout/force.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,13 @@ d3.layout.force = function() {
272272

273273
// use `node.call(force.drag)` to make nodes draggable
274274
force.drag = function() {
275+
if (!arguments.length) return drag;
276+
275277
if (!drag) drag = d3.behavior.drag()
276278
.origin(d3_identity)
277-
.on("dragstart", d3_layout_forceDragstart)
278-
.on("drag", dragmove)
279-
.on("dragend", d3_layout_forceDragend);
279+
.on("dragstart.force", d3_layout_forceDragstart)
280+
.on("drag.force", dragmove)
281+
.on("dragend.force", d3_layout_forceDragend);
280282

281283
this.on("mouseover.force", d3_layout_forceMouseover)
282284
.on("mouseout.force", d3_layout_forceMouseout)

0 commit comments

Comments
 (0)