Jump to content

I am confused by PIXI.Graphics.getBounds () behavior


Likl
 Share

Recommended Posts

I am a new for PIXI.

When I want to draw surrounding line on a rectangle , i use getBounds() method.

But there is  something difference between 2 calls,  the first time I got a coordinate which is relative to the app stage,  second time I got a coordinate which is relative to the  browser window.

However, between two calls, the  invoked PIXI.Graphics has the same parent and children .I just don't know why is it. 

Link to comment
Share on other sites

I just don't know how to abstract my problem into a demo vividly, maybe like this:

https://pixiplayground.com/#/edit/A1rmMvGweWbWYig1xE7ua

And  I have a typing error above  PIXI.Graphics.getBounds() should be PIXI.Sprite.getBounds() instead.

I noticed that in my own program, PIXI version point to 4.5.5, while the pixi-playground hold the minimum version for v4.6.1,

And in v4.6.1 , my problem didn't reproduce.  It's time to upgrade my pixi version:D

thanks for your reply a lot.

 

Link to comment
Share on other sites

I've modified demo a bit to make bounds visible.

Your problem with demo  is that bunny dont have width/height , they are not loaded yet ;) fromImage('some.png') cant get information about image right now the same way <img src=...> doesnt show you image the same , unless that image is pre-loaded. If you consolelog bunny's dimensions - you'll see zeros.

You have to use loader for that demo.

Also, I cant guarantee anything about previous versions, we've fixed so many bugs..

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...