widget scroll issue 35/108135/1 submit/tizen_3.0/20170103.063052
authorYoungHun Cho <hoon.cho@samsung.com>
Tue, 3 Jan 2017 06:25:54 +0000 (15:25 +0900)
committerYoungHun Cho <hoon.cho@samsung.com>
Tue, 3 Jan 2017 06:27:51 +0000 (15:27 +0900)
Change-Id: Ie1c95a03053cf637bf15ef45b7ce381d6a7a43d0
Signed-off-by: YoungHun Cho <hoon.cho@samsung.com>
src/cluster_view.c

index 0d8da7f..0f58972 100755 (executable)
@@ -100,6 +100,13 @@ static mouse_info_t cluster_mouse_info = {
        .pressed_obj = NULL,
 };
 
+//#define SCROLL_TIMING_ISSUE
+#ifdef SCROLL_TIMING_ISSUE
+#define SCROLL_TIMING_INTERVAL 0.001
+
+static Ecore_Timer *__scroll_timing_timer = NULL;
+#endif
+
 static Eina_Hash *cluster_menu_table = NULL;
 
 Evas_Object *__cluster_view_create_base_gui(Evas_Object *win);
@@ -154,7 +161,7 @@ static void __cluster_view_scroll_drag_stop_cb(void *data, Evas_Object *obj, voi
 static void __cluster_view_scroll_anim_start_cb(void *data, Evas_Object *obj, void *event_info);
 static void __cluster_view_scroll_anim_stop_cb(void *data, Evas_Object *obj, void *event_info);
 static void __cluster_view_scroll_start(void);
-static Eina_Bool __cluster_view_scorll_stop(void *data);
+static Eina_Bool __cluster_view_scroll_stop(void *data);
 static void __cluster_view_allpage_get_page_pos(int page_idx, int *w, int *h);
 static int __cluster_view_allpage_get_page_index(int x, int y);
 static void __cluster_view_allpage_reposition(void);
@@ -730,15 +737,42 @@ static void __cluster_view_scroll_to_home(void)
        __cluster_view_scroll_to_page(CLUSTER_HOME_PAGE, true);
 }
 
+#ifdef SCROLL_TIMING_ISSUE
+static Eina_Bool __cluster_view_scroll_show_page(void *data)
+{
+       int page_idx = *((int*)data);
+       page_indicator_set_current_page(cluster_view_s.indicator, page_idx);
+       LOGD("show %d page", page_idx);
+       elm_scroller_page_show(cluster_view_s.scroller, page_idx, 0);
+       __cluster_view_scroll_stop(NULL);
+
+       return ECORE_CALLBACK_CANCEL;
+}
+#endif
+
 static void __cluster_view_scroll_to_page(int page_idx, bool animation)
 {
+       __cluster_view_scroll_start();
+
        if (animation) {
                LOGD("bring in %d page", page_idx);
                elm_scroller_page_bring_in(cluster_view_s.scroller, page_idx, 0);
        } else {
+#ifdef SCROLL_TIMING_ISSUE
+               static int __page_idx = 0;
+               __page_idx = page_idx;
+
+               if (__scroll_timing_timer) {
+                       ecore_timer_del(__scroll_timing_timer);
+                       __scroll_timing_timer = NULL;
+               }
+               __scroll_timing_timer = ecore_timer_add(SCROLL_TIMING_INTERVAL, __cluster_view_scroll_show_page, &__page_idx);
+#else
                page_indicator_set_current_page(cluster_view_s.indicator, page_idx);
                LOGD("show %d page", page_idx);
                elm_scroller_page_show(cluster_view_s.scroller, page_idx, 0);
+               __cluster_view_scroll_stop(NULL);
+#endif
        }
 }
 
@@ -1663,7 +1697,7 @@ static void __cluster_view_scroll_drag_stop_cb(void *data, Evas_Object *obj, voi
                cluster_view_s.scroll_stop_timer = NULL;
        }
 
-       cluster_view_s.scroll_stop_timer = ecore_timer_add(SCROLL_STOP_TIME, __cluster_view_scorll_stop, NULL);
+       cluster_view_s.scroll_stop_timer = ecore_timer_add(SCROLL_STOP_TIME, __cluster_view_scroll_stop, NULL);
 }
 
 static void __cluster_view_scroll_anim_start_cb(void *data, Evas_Object *obj, void *event_info)
@@ -1676,7 +1710,7 @@ static void __cluster_view_scroll_anim_start_cb(void *data, Evas_Object *obj, vo
 
 static void __cluster_view_scroll_anim_stop_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       __cluster_view_scorll_stop(NULL);
+       __cluster_view_scroll_stop(NULL);
 }
 
 static void __cluster_view_scroll_start(void)
@@ -1694,7 +1728,7 @@ static void __cluster_view_scroll_start(void)
        }
 }
 
-static Eina_Bool __cluster_view_scorll_stop(void *data)
+static Eina_Bool __cluster_view_scroll_stop(void *data)
 {
        if (!cluster_view_s.is_srolling) {
                LOGE("scroll is already stopped");
@@ -1720,13 +1754,19 @@ static Eina_Bool __cluster_view_scroll_timer_cb(void *data)
        cluster_page_t *current_page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
 
        int next_page_idx = 0;
-       if (cluster_mouse_info.move_x > CLUSTER_EDIT_RIGHT_SCROLL_REGION) {
+       if (MIRRORING_X(cluster_mouse_info.move_x, CLUSTER_VIEW_W) > CLUSTER_EDIT_RIGHT_SCROLL_REGION) {
                next_page_idx = current_page->page_index + 1;
-       } else if (cluster_mouse_info.move_x < CLUSTER_EDIT_LEFT_SCROLL_REGION) {
+       } else if (MIRRORING_X(cluster_mouse_info.move_x, CLUSTER_VIEW_W) < CLUSTER_EDIT_LEFT_SCROLL_REGION) {
                next_page_idx = current_page->page_index - 1;
        } else {
+               cluster_view_s.edit_mode_scroll_timer = NULL;
                return ECORE_CALLBACK_CANCEL;
        }
+
+       if (next_page_idx < 0 || next_page_idx >= cluster_view_s.page_count) {
+               return ECORE_CALLBACK_RENEW;
+       }
+
        cluster_page_drag_cancel(current_page);
        __cluster_view_scroll_to_page(next_page_idx, true);
        return ECORE_CALLBACK_RENEW;