pixi-viewport
pixi-viewport copied to clipboard
Uncaught TypeError: Cannot read property 'parentElement' of null
Hello, thanks a lot for creating this library!
I've been consistently hitting the following error when I try to do scale/wheel/pinch operations and wanted to report it
Uncaught TypeError: Cannot read property 'parentElement' of null
at InteractionManager.push.../node_modules/@pixi/interaction/lib/interaction.es.js.InteractionManager.mapPositionToPoint (interaction.es.js:1611)
at InputManager.getPointerPosition (viewport.es.js:172)
at InputManager.handleWheel (viewport.es.js:191)
at HTMLBodyElement.wheelFunction (viewport.es.js:41)

Is your viewport.options.interaction set properly?
I am a bit unsure about the proper setting for that
I am passing app.renderer.plugins.interaction to interaction object as far as I know
This happens when you destroy your renderer and the viewport is still listening to the wheel event on the divWheel. You should add a listener to renderer destroy and destroy the viewport.
renderer.runners['destroy'].add({
destroy: viewport.destroy.bind(viewport)
})
in my case, I have the code invoke PIXI.Application instance's destroy() and encountered same error.
after change PIXI.Application instance's destroy method parameter, to destroy every children including viewport, seem to be solved for now.
app.destroy(boolean, {children: true});