StablexUI icon indicating copy to clipboard operation
StablexUI copied to clipboard

Make skin a DisplayObject, added as child to widget

Open RudolfVonKrugstein opened this issue 10 years ago • 3 comments

Hey,

In #122 it is sugested, that it would be nice if skins could work with displayObjects. For that they need add childs to the widget using addChild.

But in stabelxui there seems to a convention, that all childs of widgets are other widgets (Box.alignElements for example seems to assume this).

So I wonder, maybe the skin itself should be a DisplayObject, which is a child of the widget and always at index "0".

Another possibility would be, that all functions which deal with the childrens of widgets test all children whether they are of type "Widget".

I can not really foresee what impact these changes would have, and what is the better Idea. So some input would be nice!

RudolfVonKrugstein avatar Jun 05 '14 17:06 RudolfVonKrugstein

You can addchild any DisplayObject to widgets. If child of a box is not a DisplayObject then on alignment child.width & child.height is used instead of .w & .h

I don't think making skin a DisplayObject is a good idea because this will double amount of DisplayObjects on stage which is bad on mobile and extremely bad on html5.

But perhaps its a good idea to have special skin class which will use additional DisplayObject. This way one can use it when realy needed

RealyUniqueName avatar Jun 05 '14 17:06 RealyUniqueName

In case of skins, I want to add DisplayObjects which remain in the background. Currently the Box widget aligns all all its children (or unifies them), and that is not what I want for DisplayObjects from Skins. So I wonder what is the best way to change this.

RudolfVonKrugstein avatar Jun 05 '14 18:06 RudolfVonKrugstein

I think you can use Widget instance as skin's DO with w=0 and h=0, so it will not take any space in box alignment

RealyUniqueName avatar Jun 08 '14 13:06 RealyUniqueName