Lets say you’ve got a display group containing different shapes. How would you loop through it and identify the type of each? As far as I can tell, there is no concrete method to differentiate a polygon, for example, from a rect.
I’ve found:
Group: numChildren ~= nil
Circle: width == height and radius ~= nil
Rect: radius == nil and path.x4 ~= nil
RoundedRect: all others
Obviously, this is not canonical as anything other than the first 3 will be considered a roundedRect. Not ideal as there are other shapes available, like polygon.
How can we differentiate a polygon or image?