d3-drag
d3-drag copied to clipboard
remove drag.container?
drag.container was introduced by https://github.com/d3/d3-drag/commit/8277204d90cc740da189dd6fa4ac86f9a6842956 to solve #2, but it doesn't seem necessary for the case mentioned in the issue. In fact I couldn't find an example where it is used directly, and I'm a bit at a loss to create one where it might be useful.
Since event.x and y are computed as relative values (p[0] - initial p[0] + initial x), it does not seem to matter which container we choose. (Except when the container itself is moving during the gesture (!), but that's probably not a common case and would be handled by calling d3.mouse(container) or d3.pointer(event[, node]), for, I guess, a similar effect.)
Addendum: the only impact seems to be on determining the subject, which can certainly be done with the d3.pointer(event[, node]) method instead.
Here's an example "in the wild" where drag.container is used, but it can be removed with no ill effect.