[efl]Support for rotary event on page change.
authorGodly T.Alias <godly.talias@samsung.com>
Tue, 14 Apr 2020 04:37:59 +0000 (10:07 +0530)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 5 May 2020 23:37:44 +0000 (08:37 +0900)
Signed-off-by: Yukti Pandey <yukti.pandey@samsung.com>
Change-Id: I0a10ddf685522d5685ba1beab1bfa469b2adc96c

src/lib/elementary/elm_interface_scrollable.c

index 72339db..395b5fa 100644 (file)
@@ -1394,6 +1394,22 @@ _elm_scroll_scroll_bar_read_and_update(
    elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny);
    x = _round(vx * (double)mx + minx, 1);
    y = _round(vy * (double)my + miny, 1);
+   //TIZEN_ONLY(20200414): Support rotary event
+   if (!sid->freeze && _paging_is_enabled(sid))
+     {
+        x = _elm_scroll_page_x_get(sid, 0, EINA_FALSE);
+        y = _elm_scroll_page_y_get(sid, 0, EINA_FALSE);
+
+        int pagenumber_h = 0, pagenumber_v = 0;
+
+        elm_interface_scrollable_current_page_get(sid->obj, &pagenumber_h, &pagenumber_v);
+
+        if (sid->pagesize_h)
+           sid->rotary_animation_info.current_page = pagenumber_h;
+        else if (sid->pagesize_v)
+           sid->rotary_animation_info.current_page = pagenumber_v;
+     }
+   //
    elm_interface_scrollable_content_pos_set(sid->obj, x, y, EINA_TRUE);
    _elm_scroll_wanted_coordinates_update(sid, x, y);
 }
@@ -2474,6 +2490,17 @@ _elm_interface_scrollable_content_region_show(Eo *obj, Elm_Scrollable_Smart_Inte
         sid->down.x = sid->down.history[0].x;
         sid->down.y = sid->down.history[0].y;
      }
+     //TIZEN_ONLY(20200414): Support wearable rotary event
+   if (_paging_is_enabled(sid))
+     {
+        int pagenumber_h = 0, pagenumber_v = 0;
+        elm_interface_scrollable_current_page_get(sid->obj, &pagenumber_h, &pagenumber_v);
+        if (sid->pagesize_h)
+           sid->rotary_animation_info.current_page = pagenumber_h;
+        else if (sid->pagesize_v)
+           sid->rotary_animation_info.current_page = pagenumber_v;
+     }
+   //
 }
 
 //TIZEN_ONLY(20180118): Modify logics to make scroller stable on tizen
@@ -2541,6 +2568,12 @@ _scroll_wheel_post_event_job(void *data, const Eina_Value v,
      {
         sid->current_page.x = _elm_scroll_page_x_get(sid, 0, EINA_FALSE);
         sid->current_page.y = _elm_scroll_page_y_get(sid, 0, EINA_FALSE);
+        //TIZEN_ONLY(20200414): Support rotary event
+        if (sid->pagesize_h)
+           sid->rotary_animation_info.current_page = sid->current_page.x;
+        else if (sid->pagesize_v)
+           sid->rotary_animation_info.current_page = sid->current_page.y;
+        //
      }
    return v;
 }
@@ -2963,8 +2996,10 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid,
    if (!sid->pan_obj) return 0;
 
    elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
-   elm_interface_scrollable_content_viewport_geometry_get
-         (sid->obj, NULL, NULL, &w, &h);
+   //TIZEN_ONLY(20200414): Support rotary event
+   w = sid->w;
+   h = sid->h;
+   //
    elm_obj_pan_content_size_get(sid->pan_obj, &cw, &ch);
    elm_obj_pan_pos_min_get(sid->pan_obj, &minx, NULL);
 
@@ -3012,8 +3047,10 @@ _elm_scroll_page_y_get(Elm_Scrollable_Smart_Interface_Data *sid,
    if (!sid->pan_obj) return 0;
 
    elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
-   elm_interface_scrollable_content_viewport_geometry_get
-         (sid->obj, NULL, NULL, &w, &h);
+   //TIZEN_ONLY(20200414): Support rotary event
+   w = sid->w;
+   h = sid->h;
+   //
    elm_obj_pan_content_size_get(sid->pan_obj, &cw, &ch);
    elm_obj_pan_pos_min_get(sid->pan_obj, NULL, &miny);
 
@@ -3172,8 +3209,10 @@ _elm_scroll_scroll_to_y(Elm_Scrollable_Smart_Interface_Data *sid,
    if (t_in <= 0.0)
      {
         elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
-        elm_interface_scrollable_content_viewport_geometry_get
-              (sid->obj, NULL, NULL, &w, &h);
+        //TIZEN_ONLY(20200414): Support rotary event
+        w = sid->w;
+        h = sid->h;
+        //
         y = pos_y;
         elm_interface_scrollable_content_region_set(sid->obj, x, y, w, h);
         return;
@@ -3238,8 +3277,10 @@ _elm_scroll_scroll_to_x(Elm_Scrollable_Smart_Interface_Data *sid,
    if (t_in <= 0.0)
      {
         elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
-        elm_interface_scrollable_content_viewport_geometry_get
-              (sid->obj, NULL, NULL, &w, &h);
+        //TIZEN_ONLY(20200414): Support rotary event
+        w = sid->w;
+        h = sid->h;
+        //
         x = pos_x;
         elm_interface_scrollable_content_region_set
               (sid->obj, x, y, w, h);
@@ -5939,8 +5980,10 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
    sid->requested_page.loop_cnt = evas_smart_objects_calculate_count_get(evas_object_evas_get(obj));
    //END
 
-   elm_interface_scrollable_content_viewport_geometry_get
-         (sid->obj, NULL, NULL, &w, &h);
+   //TIZEN_ONLY(20200414): Support rotary event
+   w = sid->w;
+   h = sid->h;
+   //
    x = sid->pagesize_h * pagenumber_h;
    x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
    y = sid->pagesize_v * pagenumber_v;
@@ -5953,6 +5996,13 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
    if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h))
      elm_interface_scrollable_content_pos_set(obj, x, y, EINA_TRUE);
 
+   //TIZEN_ONLY(20200414): Support rotary event
+   if (sid->pagesize_h)
+      sid->rotary_animation_info.current_page = pagenumber_h;
+   else if (sid->pagesize_v)
+      sid->rotary_animation_info.current_page = pagenumber_v;
+   //
+
    if ((sid->current_page.x != x) || (sid->current_page.y != y))
      {
         if (sid->cb_func.page_change)