From 4ea61317445e81d17936e6be229f95366f1e155d Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 6 Apr 2011 07:51:26 +0000 Subject: [PATCH] Elementary smart-scroller: Fixed scroller "jumping" in some cases. In some cases, for example resizing the GenGrid test or just using ephoto, the scroller would jump to the right before going to it's proper direction. We should check if the position is below minimum after we reduce the position, and not instead. SVN revision: 58383 --- legacy/elementary/src/lib/els_scroller.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/legacy/elementary/src/lib/els_scroller.c b/legacy/elementary/src/lib/els_scroller.c index 4f8828c673..fa1477fa4e 100644 --- a/legacy/elementary/src/lib/els_scroller.c +++ b/legacy/elementary/src/lib/els_scroller.c @@ -585,8 +585,8 @@ _smart_page_x_get(Smart_Data *sd, int offset) x = x / (sd->pagesize_h); x = x * (sd->pagesize_h); } + if ((x + w) > cw) x = cw - w; if (x < minx) x = minx; - else if ((x + w) > cw) x = cw - w; return x; } @@ -614,8 +614,8 @@ _smart_page_y_get(Smart_Data *sd, int offset) y = y / (sd->pagesize_v); y = y * (sd->pagesize_v); } + if ((y + h) > ch) y = ch - h; if (y < miny) y = miny; - else if ((y + h) > ch) y = ch - h; return y; } @@ -1061,11 +1061,11 @@ _elm_smart_scroller_child_region_show_internal(Evas_Object *obj, Evas_Coord x, E sd->down.pdy = 0; } x = nx; + if ((x + w) > cw) x = cw - w; if (x < minx) x = minx; - else if ((x + w) > cw) x = cw - w; y = ny; + if ((y + h) > ch) y = ch - h; if (y < miny) y = miny; - else if ((y + h) > ch) y = ch - h; elm_smart_scroller_child_pos_set(obj, x, y); } @@ -1341,12 +1341,12 @@ elm_smart_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, sd->down.pdy = 0; } x = nx; + if ((x + w) > cw) x = cw - w; if (x < minx) x = minx; - else if ((x + w) > cw) x = cw - w; _smart_scrollto_x(sd, _elm_config->bring_in_scroll_friction, x); y = ny; + if ((y + h) > ch) y = ch - h; if (y < miny) y = miny; - else if ((y + h) > ch) y = ch - h; _smart_scrollto_y(sd, _elm_config->bring_in_scroll_friction, y); }