Max size is not relative to parent max size

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Max size is not relative to parent max size

Postby ShadowTiger » Tue Aug 02, 2011 03:06

Code: Select all

Window * parent;
parent->setMaxSize(UVector2(UDim(5,0) , UDim (5, 0)));
parent->setSize(UVector2(UDim(5,0) , UDim (5, 0)));

Window * child1;
child1->setMaxSize(UVector2(UDim(1,0) , UDim (1, 0)))
child1->setSize(UVector2(UDim(1,0) , UDim (1, 0)))
parent->addChildWindow(child1);

Window * child2;
child2->setMaxSize(UVector2(UDim(5,0) , UDim (5, 0)))
child2->setSize(UVector2(UDim(1,0) , UDim (1, 0)))
parent->addChildWindow(child2);

My assumption was that all 3 of these windows would be the same size.

The reality is that child1 is 20% the size of child2 and parent.

This is because max size is not relative to the parent, which is very counter-intuitive.

I realize this is a minor problem but consider changing this in the future.

Also, I should probably note that this example is made up, in my real code the parent is originally size 1 and is later resized to 5, but its max size is always 5, so it could be an update problem i suppose.

I'm using CEGUI 7.5

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Max size is not relative to parent max size

Postby Kulik » Tue Aug 02, 2011 08:38

All UDims are always relative to parent's pixel size. Max size is also relative to the widget's parent pixel size. Making it relative to parent's max size might work in some cases but it would completely destroy other use cases. In my opinion having it consistently relative to parent's pixel size is intuitive.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 12 guests