I'm trying to use d3-drag with a canvas a such:
select(canvas)
.call(
drag()
.container(canvas)
.subject(partial(getNodeAtMouse, simulation, canvas))
.on('start', someFunction))
However, I get the following error when I actually attempt to drag:
Cannot read property 'button' of null
from the following line in d3-drag (d3 original source code)
function defaultFilter() {
return !d3Selection.event.button;
}
If I remove that function (by specifying my own filter), I get the following error:
Cannot read property 'sourceEvent' of null
In d3-selection (d3 original source code)
function sourceEvent() {
var current = exports.event, source;
while (source = current.sourceEvent) current = source;
return current;
}
This makes me think that there is some bug between the expectations of d3-drag and d3-selection. Any ideas?