elm_panel: decide whether a scrollable panel is open or not only when it has a size

in _state_sync() function, scrollable content's position is used to tell
whether the panel is open or not. in case of a top panel, for example,
it is considered to be open when the content's vertical position equals to zero.
however, this logic has a defect in that the position is always zero
if the content size is zero - not resized properly yet. it caused unwanted results.
this patch added some codes to check
1. if the panel's width or height is bigger than zero
2. if the box which contains panel contents is visible (resizable)

@fix
This commit is contained in:
Jaeun Choi 2016-12-30 16:30:34 +09:00
parent 5fb595e714
commit 2b90e193ef
1 changed files with 10 additions and 0 deletions

View File

@ -520,9 +520,13 @@ _state_sync(Evas_Object *obj)
Eina_Bool open = EINA_FALSE, horizontal = EINA_FALSE;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
if (!evas_object_visible_get(sd->bx)) return EINA_TRUE;
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
if (h <= 0) return EINA_TRUE;
panel_size = h * sd->content_size_ratio;
elm_interface_scrollable_content_pos_get(obj, NULL, &pos);
@ -532,6 +536,8 @@ _state_sync(Evas_Object *obj)
break;
case ELM_PANEL_ORIENT_BOTTOM:
if (h <= 0) return EINA_TRUE;
panel_size = h * sd->content_size_ratio;
elm_interface_scrollable_content_pos_get(obj, NULL, &pos);
@ -541,6 +547,8 @@ _state_sync(Evas_Object *obj)
break;
case ELM_PANEL_ORIENT_LEFT:
if (w <= 0) return EINA_TRUE;
panel_size = w * sd->content_size_ratio;
elm_interface_scrollable_content_pos_get(obj, &pos, NULL);
horizontal = EINA_TRUE;
@ -560,6 +568,8 @@ _state_sync(Evas_Object *obj)
break;
case ELM_PANEL_ORIENT_RIGHT:
if (w <= 0) return EINA_TRUE;
panel_size = w * sd->content_size_ratio;
elm_interface_scrollable_content_pos_get(obj, &pos, NULL);
horizontal = EINA_TRUE;