Closed ChrisHSandN closed 4 years ago
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.
d3.drag().subject()
d3.drag().on()
datum, i, nodes
// 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?
DragEvent
this
// v6 d3 .drag() .subject((event) => { d3.select(???); })
d3.selection.on() has the event.currentTarget which would be useful/consitent for drag().*().
event.currentTarget
drag().*()
d3: v.6.2.0
Try event.sourceEvent.currentTarget.
event.sourceEvent.currentTarget
d3.drag().subject()
,d3.drag().on()
etc. used to be passeddatum, i, nodes
allowing the current node to be accessed from within an arrow function.Now it has swapped to only the
DragEvent
object there doesn't seem to be any way to access the node anymore without usingthis
?d3.selection.on() has the
event.currentTarget
which would be useful/consitent fordrag().*()
.d3: v.6.2.0