Eugenius Posted April 10, 2014 Share Posted April 10, 2014 I found Graphics class has width and height properties. I thought they would work since it's from DisplayObjectContainer but seems not working. I guessed it's because the Display Objects in the container are not sprites but vector graphics? http://jsfiddle.net/BVWQp/4/ tried setting different values into width and height. Although I use scale instead of size but it would be lovely to have such feature or update the documentation. Thanks guys Quote Link to comment Share on other sites More sharing options...
Leth Posted April 16, 2014 Share Posted April 16, 2014 I found Graphics class has width and height properties. I thought they would work since it's from DisplayObjectContainer but seems not working. It's not working because the width and height properties-functions of DisplayObjectContainer has been commented for some reasons: http://www.goodboydigital.com/pixijs/docs/files/src_pixi_display_DisplayObjectContainer.js.html#l32 They where using the local bounds of the DOC to calculate and modify the scale value. I guessed it's because the Display Objects in the container are not sprites but vector graphics? It's because a DisplayObject have no width and height. It's just like an infinite plane with some properties to help to interact with its children. If you add 4 sprites to a doc and modify the scale of the DOC, that will affect the scale of the 4 sprites. Or if you change the DOC position, that will also affect the 4 sprites position since every child position is relative to its parent. The width and height properties of a sprite do not affect the DisplayObject, they affect the size of the texture linked to the DisplayObject. Although I use scale instead of size but it would be lovely to have such feature or update the documentation. Yes, the documentation needs an update. You could add an issue to https://github.com/GoodBoyDigital/pixi.js/issues Quote Link to comment Share on other sites More sharing options...
Eugenius Posted April 16, 2014 Author Share Posted April 16, 2014 Thanks for the info Leth, Will post an issue on github Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.