elm_panel : Fix bug with set scrollable panel orient. 84/89884/2
authorJEONGHYUN YUN <jh0506.yun@samsung.com>
Tue, 27 Sep 2016 09:38:18 +0000 (18:38 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 28 Sep 2016 01:38:40 +0000 (18:38 -0700)
Summary:
1. Fix wrong logic of ELM_PANEL_ORIENT_RIGHT case in _state_sync.
2. Move pre calc function in anim_cb to sizing_eval function.
   This code have caused problem that scrollable panel is not animated during drawer open and close
3. Maintain content size ratio when orient is changed.
4. Freeze scroller when orient is changed.
   This code will need to change orientation when drawer opened.

Reviewers: Hermet

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4320

Signed-off-by: JEONGHYUN YUN <jh0506.yun@samsung.com>
Change-Id: I886723f9525261e88b5274627cc901e68735feed

src/lib/elm_panel.c

index 946081aa9dfc9c2bc5efdfea36a7e828a555cdf9..ceff5bbcb33f43e0730d271f46969c6e301b0357 100644 (file)
@@ -59,6 +59,15 @@ _elm_panel_elm_layout_sizing_eval(Eo *obj, Elm_Panel_Data *sd)
 
    if (sd->delete_me) return;
 
+   if (sd->scrollable)
+     {
+        int w, h;
+        evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+
+        if (sd->hidden) _drawer_close(obj, w, h, EINA_FALSE);
+        else _drawer_open(obj, w, h, EINA_FALSE);
+     }
+
    evas_object_smart_calculate(sd->bx);
    edje_object_size_min_calc(wd->resize_obj, &mw, &mh);
    evas_object_size_hint_min_set(obj, mw, mh);
@@ -553,7 +562,7 @@ _state_sync(Evas_Object *obj)
          eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
          horizontal = EINA_TRUE;
 
-         if (!elm_widget_mirrored_get(obj))
+         if (elm_widget_mirrored_get(obj))
            {
               if (pos == 0) open = EINA_TRUE;
               else if (pos == panel_size) open = EINA_FALSE;
@@ -1107,21 +1116,6 @@ _elm_panel_evas_object_smart_move(Eo *obj, Elm_Panel_Data *sd, Evas_Coord x, Eva
    evas_object_move(sd->hit_rect, x, y);
 }
 
-static Eina_Bool
-_elm_panel_anim_cb(void *data)
-{
-   Evas_Object *obj = data;
-   ELM_PANEL_DATA_GET(obj, sd);
-   int w, h;
-
-   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
-
-   if (sd->hidden) _drawer_close(obj, w, h, EINA_FALSE);
-   else _drawer_open(obj, w, h, EINA_FALSE);
-
-   return ECORE_CALLBACK_CANCEL;
-}
-
 EOLIAN static void
 _elm_panel_evas_object_smart_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
 {
@@ -1149,7 +1143,7 @@ _elm_panel_evas_object_smart_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, E
          break;
      }
 
-   ecore_animator_add(_elm_panel_anim_cb, obj);
+   elm_layout_sizing_eval(obj);
 }
 
 EOLIAN static void
@@ -1210,8 +1204,34 @@ _elm_panel_orient_set(Eo *obj, Elm_Panel_Data *sd, Elm_Panel_Orient orient)
    if (sd->orient == orient) return;
    sd->orient = orient;
 
-   if (sd->scrollable) _scrollable_layout_theme_set(obj, sd);
-   else _orient_set_do(obj);
+   if (sd->scrollable)
+     {
+        _scrollable_layout_theme_set(obj, sd);
+
+        if (!sd->freeze)
+          {
+             switch (sd->orient)
+               {
+                  case ELM_PANEL_ORIENT_TOP:
+                  case ELM_PANEL_ORIENT_BOTTOM:
+                     eo_do(obj, elm_interface_scrollable_movement_block_set
+                           (ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL));
+                     break;
+                  case ELM_PANEL_ORIENT_LEFT:
+                  case ELM_PANEL_ORIENT_RIGHT:
+                     eo_do(obj, elm_interface_scrollable_movement_block_set
+                           (ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL));
+                     break;
+               }
+
+             sd->freeze = EINA_TRUE;
+             elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm");
+          }
+
+        elm_panel_scrollable_content_size_set(obj, sd->content_size_ratio);
+     }
+   else
+     _orient_set_do(obj);
 
    elm_layout_sizing_eval(obj);
 }
@@ -1403,7 +1423,7 @@ _elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio
          break;
      }
 
-   ecore_animator_add(_elm_panel_anim_cb, obj);
+   elm_layout_sizing_eval(obj);
 }
 
 EOLIAN static Eina_Bool