From: Jaehwan Kim Date: Wed, 10 Apr 2013 12:17:01 +0000 (+0900) Subject: [Scroller] Fix the calculation double type number. Round off to the nearest whole... X-Git-Tag: accepted/tizen/20130607.213307~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2968979f4b60c7afe5de97f98270d11e42e769ef;p=profile%2Fmobile%2Felementary.git [Scroller] Fix the calculation double type number. Round off to the nearest whole number. Change-Id: I7158020ef0da425153a96f277a42f6aad5b6f565 --- diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c index 24501f3..e644eaa 100644 --- a/src/lib/elm_interface_scrollable.c +++ b/src/lib/elm_interface_scrollable.c @@ -52,6 +52,18 @@ elm_pan_smart_class_get(void) return class; } +static double +_round(double value, int pos) +{ + double temp; + + temp = value * pow( 10, pos ); + temp = floor( temp + 0.5 ); + temp *= pow( 10, -pos ); + + return temp; +} + static void _elm_pan_update(Elm_Pan_Smart_Data *psd) { @@ -765,8 +777,8 @@ _elm_scroll_scroll_bar_read_and_update( (sid->edje_obj, "elm.dragable.hbar", &vx, NULL); psd->api->pos_max_get(sid->pan_obj, &mx, &my); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); - x = vx * (double)mx + minx; - y = vy * (double)my + miny; + x = _round(vx * (double)mx + minx, 1); + y = _round(vy * (double)my + miny, 1); psd->api->pos_get(sid->pan_obj, &px, &py); psd->api->pos_set(sid->pan_obj, x, y); if ((px != x) || (py != y))