Jump to content

PIXI.Graphics in class doesnt work with interactivity


Sentinel
 Share

Recommended Posts

I'm totally in love with Pixi and have been for a while, but I'm running into an issue.

So everything gets drawn correctly as it should.

Now the issue is when I have to add interactivity to the actual Graphics element.

Defining an any properties to the class such as "interactive" or "buttonMode" doesn't get applied to the actual Graphics element.

Adding them after calling the super() method doesn't change anything either.

 

I've created a gist including the files used for this exactly:

https://gist.github.com/marcus-sa/3ec603f8f9c5d4bb6b0df514a4546c07

Link to comment
Share on other sites

Its based on EventEmitter3, "on('click', () => {...} )" . Adding click methods works only from outside because click is a property , when you set it, it actually calls "on('click')". Here you just overrode it and "on" wasnt called.

P..S. Also please dont use "renderer.width", it uses real pixels, you need CSS ones, "renderer.screen.width" . Of course its the same in your project, but when you add resolution (retina support) , those values will differ.

Link to comment
Share on other sites

Thanks for the fast reply.

Sadly, it didn't make a difference at all.

The graphics element is still not interactive, no matter where I assign the "interactive" property

 

EDIT:

I also discovered that none of the events works for any Pixi element regardless which it is.

It worked flawlessly earlier, but all of suddenly it doesn't anymore.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...