davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.04k stars 174 forks source link

Does not work with @pixi/webworker #443

Open scott-cornwell opened 1 year ago

scott-cornwell commented 1 year ago

pixi-viewport tires to access the window object which fails when running new Pixi 7 in a webworker

scott-cornwell commented 1 year ago

Additionally, the InputManager being initialized in a webworker crashes.

polimorficzny commented 1 year ago

@scott-cornwell The same problem on my side, when tried to run inside web worker:

window is not defined at pixi_viewport.js:1307:1

robin-rpr commented 4 months ago

Web worker run in an isolated environment that cannot access the DOM. This is not a bug but a limitation of Web Workers.

scott-cornwell commented 4 months ago

@robin-rpr I'm aware of that, but it's possible to refactor it so it does not depend on window. I have done this locally and I now have it working. So it is a bug that could be fixed.