ui.box: Add handling for weight + align

Issue: If the item has weight and non-filled align, item is not resized.
This patch fixes this issue.
Test: elementary_test -> ui.box -> Equal weight. Buttons Btn1, BtnA, B, C
do not resize when resize the window.

ref T5487
This commit is contained in:
Thiep Ha 2017-08-17 07:56:23 +09:00
parent b3722c05f9
commit 5ab5d823fa
1 changed files with 8 additions and 2 deletions

View File

@ -218,7 +218,10 @@ _efl_ui_box_custom_layout(Efl_Ui_Box *ui_box, Evas_Object_Box_Data *bd)
}
else
{
w = item->want[0] - item->pad[0] - item->pad[1];
if (horiz && item->weight[0] > 0)
w = cw - item->pad[0] - item->pad[1];
else
w = item->want[0] - item->pad[0] - item->pad[1];
x = cx + ((cw - w) * item->align[0]) + item->pad[0];
}
@ -242,7 +245,10 @@ _efl_ui_box_custom_layout(Efl_Ui_Box *ui_box, Evas_Object_Box_Data *bd)
}
else
{
h = item->want[1] - item->pad[2] - item->pad[3];
if (!horiz && item->weight[1] > 0)
h = ch - item->pad[2] - item->pad[3];
else
h = item->want[1] - item->pad[2] - item->pad[3];
y = cy + ((ch - h) * item->align[1]) + item->pad[2];
}