elm_panel: decide whether a scrollable panel is open or not only when it has a size
authorJaeun Choi <jaeun12.choi@samsung.com>
Fri, 30 Dec 2016 07:30:34 +0000 (16:30 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Fri, 30 Dec 2016 07:31:25 +0000 (16:31 +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

src/lib/elementary/elm_panel.c

index 662d44d..ec73f94 100644 (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;