openfl / openfl-html5

[deprecated] OpenFL HTML5 backend
Other
0 stars 1 forks source link

Fix .width and .height on DisplayObject #48

Closed jgranick closed 10 years ago

jgranick commented 10 years ago

48 Issue by lpmitchell,

.width and .height were not implemented on DisplayObject.

Matched implementation with DisplayObjectContainer.

jgranick commented 10 years ago

Comment by jgranick:

In which case did you find that you were having trouble?

As I understand it, Flash does not allow you to extend DisplayObject directly. As a result, DisplayObject itself has width and height, but it is empty because this was implemented in each core object that extends it, like in Bitmap, or Sprite.

I suppose it would not be wrong to have an implementation here, per se, except that it seems the implementation should definitely vary depending on the object, such as Bitmap deriving its size directly from the bitmapData size.

Do you remember in what case an object had an invalid width/height?

jgranick commented 10 years ago

Comment by lpmitchell:

Yep, flash.display.Shape inherits directly from DisplayObject - I think this is the only case where the issue is present.

jgranick commented 10 years ago

Comment by jgranick:

I suppose this makes sense -- this code is so generic, no use to even be within DisplayObjectContainer, and if there's a simpler/better way to get this from an object, it's going to override anyway, it just avoid calling the super function :) Thanks!