From 7ebcfd420c696f53a2a4376fd70ebf80afb26832 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Mon, 6 Jul 2020 13:42:11 +0900 Subject: [PATCH] efl_ui_image: fix hit_rect geometry In the past version, "clicked" event happens although image file is not set and resizable is false and scale type is expand. To keep the backward compatibility of supporting "clicked" event, hit_rect geometry is set to be the same with object geometry if image file is not set. In the past version, hit_rect geometry is not the same with object if image file is not set and resizable is false and scale type is not expand. e.g. In the past version, if object size is (360, 80), then hit_rect size is set to be (360, 360). To fix the bug in the past version related to hit_rect, hit_rect geometry is set to be the same with object geometry if image file is not set regardless of resizable and scale type. The above logic is not applied to upstream. Because size calculation logic between upstream and tizen is different so _image_sizing_eval() is not called in upstream if image file is not set. @tizen_fix Change-Id: I5bfb1c973b9710b01594d2c1cfaa538dab02a2c2 --- src/lib/elementary/efl_ui_image.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 4fb418b..bd358e7 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -296,21 +296,6 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) evas_object_image_fill_set(img, offset_x, offset_y, w, h); - /* TIZEN_ONLY(20200706): Set hit_rect geometry to the same with object. - * - * This fixes backward compatibility issue of supporting "clicked" event. - * In the past version, "clicked" event happens although image file is - * not set and resizable is false and scale type is expand. - */ - if (sd->scale_type == EFL_GFX_IMAGE_SCALE_METHOD_EXPAND) - { - x = ox; - y = oy; - w = ow; - h = oh; - } - /* END */ - if (ow - w < 0) { x = ox; @@ -328,7 +313,24 @@ done: else evas_object_geometry_set(img, x, y, w, h); - evas_object_geometry_set(sd->hit_rect, x, y, w, h); + /* TIZEN_ONLY(20200706): Set hit_rect geometry to the same with object. + * + * This fixes backward compatibility issue of supporting "clicked" event. + * In the past version, "clicked" event happens although image file is not + * set and resizable is false and scale type is expand. + * + * This also fixes the bug in the past version related to hit_rect size. + * In the past version, hit_rect geometry is not the same with object if + * image file is not set and resizable is false and scale type is not expand. + * e.g. In the past version, if object size is (360, 80), then hit_rect size + * is set to be (360, 360). + */ + //evas_object_geometry_set(sd->hit_rect, x, y, w, h); + if (img_no_resize) + evas_object_geometry_set(sd->hit_rect, ox, oy, ow, oh); + else + evas_object_geometry_set(sd->hit_rect, x, y, w, h); + /* END */ } static inline void -- 2.7.4