From e1ea913a228b3b5598b5ebeacc9620d45d45c547 Mon Sep 17 00:00:00 2001 From: "wonguk.jeong" Date: Mon, 21 Apr 2014 15:06:28 +0900 Subject: [PATCH] elm_interface_scrollable: fix wanted coordinate calculation Summary: boundary check of _elm_scroll_wanted_coordinates_update() is wrong. boundary was checked with assumption that 0, 0 is top, left however, 0, 0 could be different according to usages, in case of gengrid, 0, 0 was center left not top left) Do not assume the min/max value, but use pan min/max value for boundary check Fixes T1092 Test Plan: elementary_test -> grid -> uncheck multi select mode -> select first item -> click bring in -> resize window Reviewers: raster, woohyun, seoz, zmike CC: seoz Maniphest Tasks: T1092 Differential Revision: https://phab.enlightenment.org/D720 --- .../src/lib/elm_interface_scrollable.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/legacy/elementary/src/lib/elm_interface_scrollable.c b/legacy/elementary/src/lib/elm_interface_scrollable.c index 61610e2179..d620023225 100644 --- a/legacy/elementary/src/lib/elm_interface_scrollable.c +++ b/legacy/elementary/src/lib/elm_interface_scrollable.c @@ -1198,27 +1198,26 @@ _elm_scroll_wanted_coordinates_update(Elm_Scrollable_Smart_Interface_Data *sid, Evas_Coord x, Evas_Coord y) { - Evas_Coord cw, ch; + Evas_Coord mx = 0, my = 0, minx = 0, miny = 0; if (!sid->pan_obj) return; - eo_do(sid->pan_obj, elm_obj_pan_content_size_get(&cw, &ch)); + eo_do(sid->pan_obj, elm_obj_pan_pos_max_get(&mx, &my)); + eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny)); /* Update wx/y/w/h - and if the requested positions aren't legal * adjust a bit. */ eo_do(sid->obj, elm_interface_scrollable_content_viewport_geometry_get (NULL, NULL, &sid->ww, &sid->wh)); - if (x < 0) - sid->wx = 0; - else if ((x + sid->ww) > cw) - sid->wx = cw - sid->ww; + + if (x < minx) sid->wx = minx; + else if (x > mx) sid->wx = mx; else if (sid->is_mirrored) sid->wx = _elm_scroll_x_mirrored_get(sid->obj, x); - else - sid->wx = x; - if (y < 0) sid->wy = 0; - else if ((y + sid->wh) > ch) - sid->wy = ch - sid->wh; + else sid->wx = x; + + if (y < miny) sid->wy = miny; + else if (y > my) sid->wy = my; else sid->wy = y; }