Page 1 of 1

Max size is not relative to parent max size

Posted: Tue Aug 02, 2011 03:06
by ShadowTiger

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

Re: Max size is not relative to parent max size

Posted: Tue Aug 02, 2011 08:38
by Kulik
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.