elementary: fix the size calculation on the collection view.

Summary:
fixing size calculation errors in the collection view.
edje object need to be restricted calculation for giving min size properly.
by calling efl_layout_calc_size_min() instead of efl_gfx_hint_size_min_get()
get proper minimum size of item based on restricted finger size.

Depends on D9741

Reviewers: cedric, bu5hm4n, felipealmeida, lauromoura, zmike

Reviewed By: zmike

Subscribers: zmike

Tags: #efl_widgets

Differential Revision: https://phab.enlightenment.org/D9742
This commit is contained in:
SangHyeon Jade Lee 2019-08-26 08:33:19 -04:00 committed by Mike Blumenkrantz
parent 6a1a0eb880
commit 1255512b40
1 changed files with 20 additions and 6 deletions

View File

@ -323,7 +323,11 @@ _entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity)
if (ITEM_SIZE_FROM_MODEL(model, item_size)) return EINA_FALSE;
item_size = efl_gfx_hint_size_min_get(entity);
//FIXME: size min get returns wrong min values.
item_size.w = _elm_config->finger_size;
item_size.h = _elm_config->finger_size;
item_size = efl_layout_calc_size_min(entity, item_size);
//item_size = efl_gfx_hint_size_min_get(entity);
_size_to_model(model, item_size);
return EINA_TRUE;
}
@ -435,6 +439,7 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
Efl_Ui_Collection_Item_Lookup *lookup;
Efl_Model *model;
Eina_Size2D item_size;
Eo *entity;
if (!pd->cache) goto not_found;
@ -445,15 +450,20 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
// In the cache we should always have model, so no need to check for it
model = lookup->item.model;
entity = lookup->item.entity;
// If we do not know the size
if (!ITEM_SIZE_FROM_MODEL(model, item_size))
{
// But can calculate it now
if (!lookup->item.entity) goto not_found;
if (!entity) goto not_found;
item_size = efl_gfx_hint_size_min_get(lookup->item.entity);
// printf("%lu %p %s-%s\n", search_index,lookup->item.entity, efl_text_get(lookup->item.entity), efl_class_name_get(lookup->item.entity));
//FIXME: size min get returns wrong min values.
item_size.w = _elm_config->finger_size;
item_size.h = _elm_config->finger_size;
item_size = efl_layout_calc_size_min(entity, item_size);
//item_size = efl_gfx_hint_size_min_get(entity);
// printf("%lu %p %s-%s\n", search_index, entity, efl_text_get(entity), efl_class_name_get(entity));
item_size.w = MAX(item_size.w, 10);
item_size.h = MAX(item_size.h, 10);
_size_to_model(model, item_size);
@ -707,7 +717,7 @@ _batch_size_cb(void *data, int start_id, Eina_Rw_Slice memory)
Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity;
Eina_Bool entity_request = EINA_FALSE;
if (!model)
if (model)
{
Eina_Size2D item_size;
Eina_Bool found = EINA_FALSE;
@ -716,7 +726,11 @@ _batch_size_cb(void *data, int start_id, Eina_Rw_Slice memory)
found = EINA_TRUE;
if (!found && entity)
{
item_size = efl_gfx_hint_size_min_get(entity);
//FIXME: size min get returns wrong min values.
item_size.w = _elm_config->finger_size;
item_size.h = _elm_config->finger_size;
item_size = efl_layout_calc_size_min(entity, item_size);
//item_size = efl_gfx_hint_size_min_get(entity);
_size_to_model(model, item_size);
found = EINA_TRUE;
}