ByronHsu

How to resize windows anytime and access mouse position directly in pixi.js?

Recommended Posts

1.  How to resize the window at any time when I change my window size. Something weird will occur in my app now like the image below.(the right size should be black)

2. How can I directly access mouse local position without listening to an event. I want to deliver my mouse local position to the server even if the mouse doesn't move at all.

Thx a lot!!

Screen Shot 2017-12-10 at 1.06.00 AM.png

Screen Shot 2017-12-10 at 1.06.03 AM.png

Share this post


Link to post
Share on other sites

Its html thingy, "window.onresize = ..." . Please search forums for code, any "resize" in this pixi subforum , like this thread: 

 , just add "window.onresize=coolResize" instead of putting it in app.ticker and it'll be fine. However you can just take that code and use, it will also work.

Share this post


Link to post
Share on other sites

'app.renderer.plugins.interaction.mouse.global`  . Interaction here is instance of https://github.com/pixijs/pixi.js/blob/dev/src/interaction/InteractionManager.js that is created for every renderer. I hope that'll be changed in v5, because mouse coords after 5 dots is a strange thing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.