Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: click handlers not working on sprites #416

Open
fergusmeiklejohn opened this issue Feb 18, 2023 · 4 comments
Open

Bug: click handlers not working on sprites #416

fergusmeiklejohn opened this issue Feb 18, 2023 · 4 comments
Assignees

Comments

@fergusmeiklejohn
Copy link

Current Behavior

I've found a bug with the Sprite click handlers. See repo and 20sec video for clear explanation.. Basically if a Sprite Texture is in the stage, and the page is refreshed, the click handlers on the image Sprite will work, comment out the Texture and refresh and the click handlers stop working.

Expected Behavior

Click handlers should always work

Steps to Reproduce

https://stackblitz.com/edit/vitejs-vite-21bwq5?file=src%2FApp.tsx

CleanShot.2023-02-18.at.10.52.03.mp4

Environment

    "@pixi/react": "^7.0.2",
    "pixi.js": "^7.1.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"

Possible Solution

No response

Additional Information

No response

@fergusmeiklejohn
Copy link
Author

Seems related to this issue: #402

@SergeyAlexeev
Copy link

Hi! Are there any updates?)

@lostfictions
Copy link

Click events are also not working for me. I guess pixi-react is just like... aspirational? Like it's not really a thing that is ready for general usage?

@hreinn91
Copy link

hreinn91 commented May 25, 2024

Hey I think you need to import pixi events to get it to work.
Add this as a import, it's enough to add it in the same file as where you define the Stage it will propagate.

import '@pixi/events';

This is mentioned in the FAQ of the pixi-react 'About' page: https://pixijs.io/pixi-react/

I tried adding the import in your stackblitz example and that did indeed resolve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants