Closed sabigara closed 2 years ago
First of all, thank you for creating this awesome library! It's been helping me a lot.
I'm trying to use @pixi/events plugin (doc) with react-pixi but experiencing trouble.
@pixi/events
react-pixi
We need to delete the default interaction plugin before installing @pixi/events:
interaction
import { Renderer, Loader } from "pixi.js"; delete Renderer.__plugins.interaction; const app = new PIXI.Application(); const { renderer } = app; renderer.addSystem(EventSystem, 'events');
But react-pixi is trying to set the resolution of interaction at: https://github.com/inlet/react-pixi/blob/11e258e05f57a7609831125bb89b226bc685ccc6/src/stage/index.js#L211-L213
So an error is thrown.
It seems react-pixi only refers to plugins.interaction here so a simple existance check may be enough:
plugins.interaction
resetInteractionManager() { if("interaction" in this.app.renderer.plugins) { this.app.renderer.plugins.interaction.resolution = this.app.renderer.resolution } }
If this solution is OK, I would make a PR.
https://codesandbox.io/s/thirsty-cloud-cd17s3?file=/src/App.js
@inlet/react-pixi
React
ReactDOM
PIXI
Sounds like a good solution, yes please create a PR. Thanks!
Fixed in #335
Description
First of all, thank you for creating this awesome library! It's been helping me a lot.
I'm trying to use
@pixi/events
plugin (doc) withreact-pixi
but experiencing trouble.We need to delete the default
interaction
plugin before installing@pixi/events
:But
react-pixi
is trying to set the resolution ofinteraction
at: https://github.com/inlet/react-pixi/blob/11e258e05f57a7609831125bb89b226bc685ccc6/src/stage/index.js#L211-L213So an error is thrown.
It seems
react-pixi
only refers toplugins.interaction
here so a simple existance check may be enough:If this solution is OK, I would make a PR.
Steps to reproduce
https://codesandbox.io/s/thirsty-cloud-cd17s3?file=/src/App.js
Additional info
@inlet/react-pixi
version: 6.6.5React
version: 17.0.2ReactDOM
version: 17.0.2PIXI
version: 6.3.0