d3 / d3-drag

Drag and drop SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-drag
ISC License
332 stars 62 forks source link

Update README.md with clarifications #60

Closed nathanhack closed 5 years ago

nathanhack commented 5 years ago

While working through an example I realized the descriptions were missing the nodes that would be passed to the function. With it explicitly being left out it seemed to imply they would not be included. Having them all there, makes it clear. (I must say I personally prefer it explicitly listing it next the function rather than a link to be inferred).

mbostock commented 5 years ago

The index and nodes will probably be going away in the future (major version) because it leads to a memory leak. https://github.com/d3/d3-selection/issues/189

nathanhack commented 5 years ago

Ah. Giving the case that it is going to change in the next major version (is it going to be soon?) I would prefer to do almost the opposite of what I did, with one addendum.

How does this sound, I'll remove all mention to d,i, and nodes from the listeners (in d3-drag) leaving the link to selection.on and if the link to selection.on listeners isn't there add it (which I believe it is so no action needed)? That way when the next major version rolls around the only place that'll need updating is the one in selection.on. and for the addendum I'll update the selection.on section to help those being redirected so that it is a bit more clear (not sure what that would be atm but I'll give it some thought and if i come up with something i can put in a PR).

mbostock commented 5 years ago

Closing as this will be addressed when we update to d3-selection@2, which removed d3.event and the index, nodes callback arguments.