StarlingGraphics / Starling-Extension-Graphics

flash.display.Graphics style extension for the Starling Flash GPU rendering framework
https://github.com/StarlingGraphics/Starling-Extension-Graphics/wiki
MIT License
282 stars 89 forks source link

Width returns 0 #138

Closed kerissakti closed 9 years ago

kerissakti commented 9 years ago

After pulling to the latest git. I found a problem with getting a shape's width

loadingBarContainer = new ShapeEx(); loadingBarContainer.graphics.lineStyle(4,0xffffff); loadingBarContainer.graphics.drawRect(0, 0, 400, 10); container.addChild(loadingBarContainer);

when I call loadingBarContainer.width, this usually returns 400 but now it always returns 0

IonSwitz commented 9 years ago

Ah, I'm sure this is a problem with the change to making the Graphic base class a DisplayObjectContainer rather than a DisplayObject. I will investigate, and I am really sorry.

IonSwitz commented 9 years ago

First off: THANK YOU for the easy reproduction case. That really helps :)

Secondly: I have found the bug and I have submited the fix, but are you sure it returned 400 before? It should return 404, since the thickness of the line is 4. The width should be (from left to right) "half Thickness" + total width + "half thickness", ie 2 + 400 + 2.

I have uploaded the fix, but please get back to me about the width. If it used to return 400, that was a bug, I would think.

Also, please, keep an eye out for other mistakes that can have happened due to the change mentioned above, I would really appreciate the assistance

kerissakti commented 9 years ago

Ups, yes you were right, it returned 404 and not 400. Thanks for fixing it so quickly

IonSwitz commented 9 years ago

Also, I realized that the bug above was just the tip of the iceberg. I will go back to having the Graphic class extending DisplayObject, and not DisplayObjectContainer. That caused more headaches then I wanted