efl_ui/flow.box: fix item calc with mixed weights
authorMike Blumenkrantz <zmike@samsung.com>
Thu, 1 Aug 2019 17:31:58 +0000 (13:31 -0400)
committerWooHyun Jung <wh0705.jung@samsung.com>
Mon, 5 Aug 2019 02:51:00 +0000 (11:51 +0900)
if a box contains an entire row of items with weight(0), and the next
row contains items with weights set, the item count must be correctly
incremented so that the box uses the right items in its calculations

@fix

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9480

src/lib/elementary/efl_ui_box_flow.c

index 82917f0..2ad1fd7 100644 (file)
@@ -193,6 +193,7 @@ _efl_ui_box_flow_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Box_Flow_Data *pd
 
         cross_min_sum += row->cross_space;
         cross_weight_sum += row->cross_weight;
+        item_last += row->item_count;
 
         if (bd->homogeneous)
           continue;
@@ -205,7 +206,6 @@ _efl_ui_box_flow_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Box_Flow_Data *pd
              calc_size = box_size;
              inlist = NULL;
 
-             item_last += row->item_count;
              for (; i < item_last; i++)
                {
                   double denom;
@@ -246,6 +246,7 @@ _efl_ui_box_flow_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Box_Flow_Data *pd
         else if (EINA_DBL_EQ(row->weight_sum, 0))
           {
              row->cur_pos += (box_size - row->min_sum) * box_calc[axis].align;
+             i += row->item_count;
           }
      }