d3/d3-drag

Dispatching mousedown event with drag behaviour throws error

Mourdraug opened this issue · 1 comments

I wrote small jsFiddle to demonstrate issue.
Dispatching 'mousedown' event on selection with drag behaviour results in TypeError: Cannot read property 'document' of undefined.

I need to add element on mousedown, and drag it along untill I release it, but since it does not exist on actual mousedown I'm trying to dispatch event after its added.

You can’t use selection.dispatch to dispatch a mouse event; it dispatches custom events. It might be possible to dispatch a mouse event programmatically but you’ll need to do it using the appropriate W3C API and to populate the appropriate fields.