BasomtiKombucha Posted September 19, 2014 Share Posted September 19, 2014 Hi!I've noticed some really strange behavior when rendering WebGL primitives with pixi. Is this an issue, or should it behave like this? First, when asking for the primitives dimensions, they are always increased by 20:var graphics = new PIXI.Graphics();graphics.lineStyle(1, 0xffd900, 1);graphics.drawRect(0, 0, 1, 100);stage.addChild(graphics);console.log(graphics.width);console.log(graphics.height);output:22121Second, when asked for its dimensions before there are any, the dimensions in the whole object break and there does not seem to be a way to get them once they really are in there:var graphics = new PIXI.Graphics();graphics.lineStyle(1, 0xffd900, 1);console.log(graphics.width);graphics.drawRect(0, 0, 1, 100);stage.addChild(graphics);console.log(graphics.width);output:NaNNaN Quote Link to comment Share on other sites More sharing options...
BasomtiKombucha Posted September 19, 2014 Author Share Posted September 19, 2014 Nevermind, I think I've figured what's up with the first one.The Graphics class has a 'padding' property that changes its bounds for some reason. Once it's set to zero, it works normally. Still unsure why it's there tho. hubert 1 Quote Link to comment Share on other sites More sharing options...
d13 Posted September 19, 2014 Share Posted September 19, 2014 Still unsure why it's there tho.I've also wondered why there's default 10 pixel padding on graphics objects.I had a similar "bug" till I realized the same thing you did.Does anyone out there know why Pixi does this? Quote Link to comment Share on other sites More sharing options...
hubert Posted September 19, 2014 Share Posted September 19, 2014 Already discussed here with a solution [question answered by Sebastian Nette] http://www.html5gamedevs.com/topic/8530-different-size-of-a-container-when-combining-graphics-and-sprite-in-a-displayobjectcontainer/ http://www.sevenative.com 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.