From: PRINCE KUMAR DUBEY <prince.dubey@samsung.com>

Subject: [E-devel] [Patch] [Elementary] Support for circular effect in
elm_diskselector, in case scroller's bounce effect is disabled.

Can someone please review the attached patch created by Sumanth.

[Issue Details] :
elm_diskselector_round_enable_set() API is not working, if
elm_scroller's bounce effect is disabled.

[Root cause] :
For diskselector circular effect, the boundary checking is done based
on scroller's geometry.
If bouncing effect is disabled in elm_scroller, its geometry can lie
between 0 on left and CHILD_SIZE on right but it can never go beyond
that point.
Unless the scroller's geometry goes beyond its child (here, elm_box)
size, diskselector cann't trigger the circular effect.

[Change Description] :
For diskselector items circular effect, the boundary checking is
performed at the left/right edges of its child, elm_box.
Once the scroller reaches to the left/right edge of box or goes beyond
that point, circular effect will be triggered.



SVN revision: 76606
This commit is contained in:
PRINCE KUMAR DUBEY 2012-09-13 11:55:24 +00:00 committed by Carsten Haitzler
parent 0fb69c0e37
commit bc2a1bd996
4 changed files with 46 additions and 11 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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;
}
}
}

View File

@ -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