block by hlvoorhees 5376764

d3 x3dom event test

Full Screen

Testing D3 mouse events with X3dom elements.

The x3dom canvas captures onclick events, so just defining a 3d event handler on an x3dom element does not work. Hence, clicking the red cube does nothing.

A workaround is to define an onclick handler which calls the 3d ‘click’ event handler with the event, as demonstrated by clicking on the blue sphere. Note that x3dom event members differ from d3’s, so d3.mouse() function does not work.

Another solution, applied to the green cone, is to call addEventListener(“click”,…).