diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 28fccf8fca..28359e04e1 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -481,3 +481,7 @@ 2012-09-12 Davide Andreoli (davemds) * Add external property "play length" to Video widget, read-only. + +2012-09-13 Prince Kumar Dubey + + * Fix diskselector when bounce off and round enabled. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index b663cfecb2..c1fe0b061b 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -23,7 +23,8 @@ Fixes: * Now elm_datetime_field_limit_set() can set year limits wihtout problems. * Fix re-order animation when it doesn't end correctly. * Fix popup to apply the same style to the notify sub-widget. - * Fix Ctxpopup direction if -1 priority used + * Fix Ctxpopup direction if unknown priority used. + * Fix diskselector when bounce off and round enabled. Removals: diff --git a/legacy/elementary/src/lib/elm_diskselector.c b/legacy/elementary/src/lib/elm_diskselector.c index 532038d006..39c666468a 100644 --- a/legacy/elementary/src/lib/elm_diskselector.c +++ b/legacy/elementary/src/lib/elm_diskselector.c @@ -848,7 +848,9 @@ static void _scroll_cb(Evas_Object *obj, void *data __UNUSED__) { - Evas_Coord x, y, w, h, bw; + Evas_Coord x, y, w, h, bw, x_boundary; + unsigned int adjust_pixels; + Eina_Bool h_bounce; ELM_DISKSELECTOR_DATA_GET(obj, sd); @@ -858,15 +860,41 @@ _scroll_cb(Evas_Object *obj, if (sd->round) { evas_object_geometry_get(sd->main_box, NULL, NULL, &bw, NULL); - if (x > ((w / sd->display_item_num) * (sd->item_count - + (sd->display_item_num % 2)))) - sd->s_iface->content_region_show - (obj, x - ((w / sd->display_item_num) * sd->item_count), - y, w, h); - else if (x < 0) - sd->s_iface->content_region_show - (obj, x + ((w / sd->display_item_num) * sd->item_count), - y, w, h); + x_boundary = bw - w; + + if (x >= x_boundary) + { + if (sd->left_boundary_reached) return; + + sd->right_boundary_reached = EINA_TRUE; + sd->s_iface->bounce_allow_get(obj, &h_bounce, NULL); + /* If scroller's bounce effect is disabled, add 1 pixel + * to provide circular effect */ + adjust_pixels = (_elm_config->thumbscroll_bounce_enable + && h_bounce) ? 0 : 1; + sd->s_iface->content_region_show + (obj, x - x_boundary + adjust_pixels, y, w, h); + sd->left_boundary_reached = EINA_FALSE; + } + else if (x <= 0) + { + if (sd->right_boundary_reached) return; + + sd->left_boundary_reached = EINA_TRUE; + sd->s_iface->bounce_allow_get(obj, &h_bounce, NULL); + /* If scroller's bounce effect is disabled, subtract 1 pixel + * to provide circular effect */ + adjust_pixels = (_elm_config->thumbscroll_bounce_enable + && h_bounce) ? 0 : 1; + sd->s_iface->content_region_show + (obj, x + x_boundary - adjust_pixels, y, w, h); + sd->right_boundary_reached = EINA_FALSE; + } + else + { + sd->left_boundary_reached = EINA_FALSE; + sd->right_boundary_reached = EINA_FALSE; + } } } diff --git a/legacy/elementary/src/lib/elm_widget_diskselector.h b/legacy/elementary/src/lib/elm_widget_diskselector.h index 30d92c4286..6a21cd4d35 100644 --- a/legacy/elementary/src/lib/elm_widget_diskselector.h +++ b/legacy/elementary/src/lib/elm_widget_diskselector.h @@ -151,6 +151,8 @@ struct _Elm_Diskselector_Smart_Data Eina_Bool init : 1; Eina_Bool round : 1; Eina_Bool display_item_num_by_api : 1; + Eina_Bool left_boundary_reached:1; + Eina_Bool right_boundary_reached:1; }; struct _Elm_Diskselector_Item