dst Posted November 11, 2014 Share Posted November 11, 2014 Hi, noticed a potential issue with Pixi 2.0. If I add two or more Graphics objects to a DisplayObjectContainer, placing them at different x or y values, every time I call width/height on the DisplayObjectContainer it is an increasing value. Example:function init() { var canvas = document.getElementById('canvas'); canvas.style.width = String(window.innerWidth) + "px"; canvas.style.height = String(window.innerHeight) + "px"; var options = { view:canvas, resolution:window.devicePixelRatio }; renderer = PIXI.autoDetectRecommendedRenderer(window.innerWidth, window.innerHeight, options); stage = new PIXI.Stage(0xFFFFFF); container = new PIXI.DisplayObjectContainer(); stage.addChild(container); for(var i = 0; i < 2; i++) { var rect = new PIXI.Graphics(); rect.beginFill(0xCCCCCC, 0.4); rect.drawRect(0, 0, 50, 50); rect.endFill(); rect.x += i * 100; container.addChild(rect); } console.log("container.width: ", container.width); console.log("container.width: ", container.width); console.log("container.width: ", container.width); console.log("container.width: ", container.width); console.log("container.width: ", container.width); console.log("container.width: ", container.width); console.log("container.width: ", container.width); renderer.render(stage); requestAnimFrame(update);}function update() { renderer.render(stage); requestAnimFrame(update);} This logs the following:container.width: 150 container.width: 250 container.width: 350 container.width: 450 container.width: 550 container.width: 650 container.width: 750 Quote Link to comment Share on other sites More sharing options...
dst Posted November 11, 2014 Author Share Posted November 11, 2014 It's worth noting that if I comment out the following line (placing the Graphics objects at the same x and y) the width reported is correct:rect.x += i * 100; Quote Link to comment Share on other sites More sharing options...
dst Posted November 11, 2014 Author Share Posted November 11, 2014 I also commented on an issue(s) in the GitHub repo that is related (2nd post): https://github.com/GoodBoyDigital/pixi.js/issues/1135 Quote Link to comment Share on other sites More sharing options...
dst Posted November 12, 2014 Author Share Posted November 12, 2014 It's now been fixed on the dev branch 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.