Closed brianensorapps closed 11 years ago
Hi Brian, thanks a lot for the heads-up and the fix!
You're right, quads should work even when they are initialized with a width or height of zero. I had a look at it, and chose to implement a different fix as the one you suggested, though. The problem is that when you override the "setWidth:" and "setHeight:" methods, the quad will react a little different to size changes than before. Remember: when you rotate a quad (e.g. by 45 deg), you will get a different width, because it will always return the width of the bounding box. The setter should act just the same.
For this reason, I simply defined minimal values for width and height. They are small enough that the quad is still effectively invisible when one of the values is zero; but on resizing, the conventional setters will work correctly.
Nevertheless, thanks for making me aware of that!!
I discovered this bug when I created an SPTextField with height 0 and then set it to a height > 0. It wasn't visible and it reported its height as 0. I traced this issue to SPQuad.
If you create a quad with width or height = 0 and then set it to > 0 later, it does not update. The quad is effectively invisible. One would expect that the quad would be resized correctly even when initialized with height = 0.
This change fixes that bug by resetting the vertexData involving width and height when the width or height of a quad changes.