plottable
plottable copied to clipboard
Interactions error if registered on detached Component
var xAxis = ...
xAxis.renderTo(...);
new Plottable.Interactions.PanZoom(xScale).attachTo(xAxis);
xAxis.detach().destroy();
Then, try to click or pan/zoom, you'll hit:
Uncaught TypeError: Cannot read property 'node' of undefined at Translator.isInside...
The erroneous line is in transformAwareTranslator:
return Utils.DOM.contains(component.root().rootElement().node() as Element, e.target as Element);
Workaround: detach the panzoom interaction when you detach the axis.
Request: we should either:
a. detach interactions automatically when the connected element is detached (and re-attach them, maybe?)
b. register interactions on the .element()
instead of the .rootElement()
This also reproduces for me when using canvas rendering (which makes sense), but it would be nice if the error here was more helpful for features that are supported w/ SVG but not canvas.
@Zerim all interactions should support both SVG and Canvas. Which feature are you seeing not working?
This reproduced for me while trying to attach a Pointer interaction to a Rectangle plot using the canvas renderer.