panel: decide whether a scrollable panel is open or not only when it has a size
authorJaeun Choi <jaeun12.choi@samsung.com>
Fri, 23 Dec 2016 13:01:44 +0000 (22:01 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 05:37:12 +0000 (14:37 +0900)
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

Change-Id: I997332005033cbeb3a0ebd70238de8541b257726

src/lib/elm_panel.c

index acbd48be0411df9eac338dd485fd9cffe4a53c1d..beed2ceb7c25ed786e6ab3721123fa8630b19cc2 100644 (file)
@@ -518,9 +518,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;
          eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
 
@@ -530,6 +534,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;
          eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
 
@@ -539,6 +545,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;
          eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
          horizontal = EINA_TRUE;
@@ -558,6 +566,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;
          eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
          horizontal = EINA_TRUE;