DragEvent missing event.currentTarget for arrow function node selection
ChrisHSandN opened this issue · comments
ChrisHSandN commented
d3.drag().subject()
, d3.drag().on()
etc. used to be passed datum, i, nodes
allowing the current node to be accessed from within an arrow function.
// v5
d3
.drag()
.subject((datum, i, nodes) => {
d3.select(nodes[i]);
})
Now it has swapped to only the DragEvent
object there doesn't seem to be any way to access the node anymore without using this
?
// v6
d3
.drag()
.subject((event) => {
d3.select(???);
})
d3.selection.on() has the event.currentTarget
which would be useful/consitent for drag().*()
.
d3: v.6.2.0
Mike Bostock commented
Try event.sourceEvent.currentTarget
.