From 72367819630d0e0bb17422cdc38a2f11345fa6b7 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Mon, 25 Apr 2016 18:34:02 +0900 Subject: [PATCH] [genlist] enable item align feature for wearable profile Change-Id: I76fc335ea8c33391f91190cbeadf9ee29de2ec96 Signed-off-by: SangHyeon Lee --- src/lib/elementary/elm_interface_scrollable.c | 85 +++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index ea13a22..1ac0f64 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -183,6 +183,14 @@ _elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *_pd EINA_UNUSED, E *y = 0; } +// TIZEN_ONLY(20150705): Genlist item align feature +EOLIAN static void +_elm_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd EINA_UNUSED, Evas_Coord *x EINA_UNUSED, Evas_Coord *y EINA_UNUSED) +{ + +} +// + EOLIAN static void _elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, Evas_Coord *w, Evas_Coord *h) { @@ -2222,10 +2230,23 @@ _elm_scroll_momentum_animator(void *data, const Efl_Event *event EINA_UNUSED) dt = dt / at; if (dt > 1.0) dt = 1.0; p = 1.0 - ((1.0 - dt) * (1.0 - dt)); - dx = (sid->down.dx * (_elm_config->thumbscroll_friction + - sid->down.extra_time) * p); - dy = (sid->down.dy * (_elm_config->thumbscroll_friction + - sid->down.extra_time) * p); + + // TIZEN_ONLY(20150705): Genlist item align feature + if (_elm_config->scroll_item_align_enable) + { + dx = sid->down.dx * p; + dy = sid->down.dy * p; + } + else + { + // + dx = (sid->down.dx * (_elm_config->thumbscroll_friction + + sid->down.extra_time) * p); + dy = (sid->down.dy * (_elm_config->thumbscroll_friction + + sid->down.extra_time) * p); + // TIZEN_ONLY(20150705): Genlist item align feature + } + // sid->down.ax = dx; sid->down.ay = dy; x = sid->down.sx - dx; @@ -2690,6 +2711,28 @@ _elm_scroll_mouse_up_event_cb(void *data, { sid->down.dy += (double)sid->down.pdy * _elm_config->thumbscroll_acceleration_weight; } + + // TIZEN_ONLY(20150705): Genlist item align feature + if (_elm_config->scroll_item_align_enable) + { + Evas_Coord pos_x, pos_y; + + pos_x = sid->down.dx; + pos_y = sid->down.dy; + + pos_x = _round(pos_x * (_elm_config->thumbscroll_friction + + sid->down.extra_time), 0); + pos_y = _round(pos_y * (_elm_config->thumbscroll_friction + + sid->down.extra_time), 0); + + elm_obj_pan_pos_adjust(sid->pan_obj, &pos_x, &pos_y); + + // adjusted position using to _elm_scroll_momentum_animator() + sid->down.dx = pos_x; + sid->down.dy = pos_y; + } + // + sid->down.pdx = sid->down.dx; sid->down.pdy = sid->down.dy; ox = -sid->down.dx; @@ -2715,7 +2758,41 @@ _elm_scroll_mouse_up_event_cb(void *data, sid->down.b0y = 0; } } +// TIZEN_ONLY(20150705): Genlist item align feature + else + { + if (_elm_config->scroll_item_align_enable) + { + Evas_Coord pos_x = 0, pos_y = 0; + Evas_Coord adjust_x, adjust_y; + + sid->pan_obj, elm_obj_pan_pos_adjust(sid->pan_obj, &pos_x, &pos_y); + + elm_interface_scrollable_content_pos_get(sid->obj, &adjust_x, &adjust_y); + pos_y = -pos_y; + adjust_y += pos_y; + + _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, adjust_y); + } + } + } + else + { + if (_elm_config->scroll_item_align_enable) + { + Evas_Coord pos_x = 0, pos_y = 0; + Evas_Coord adjust_x, adjust_y; + + elm_obj_pan_pos_adjust(sid->pan_obj, &pos_x, &pos_y); + + elm_interface_scrollable_content_pos_get(sid->obj, &adjust_x, &adjust_y); + pos_y = -pos_y; + adjust_y += pos_y; + + _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, adjust_y); + } } +// } else { -- 2.7.4