forked from enlightenment/efl
efl_ui_image: fix to call "clicked" smart callback when there is no img
Summary: Some applications have used "clicked" smart callback from elm_image which does not have an image in it. To keep backward compatibility, hit_rect needs to be resized properly to call smart callback function. @fix Reviewers: Hermet, jsuya, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11840
This commit is contained in:
parent
e4964f94fa
commit
a030859f67
|
@ -181,6 +181,7 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img)
|
||||||
{
|
{
|
||||||
Evas_Coord x = 0, y = 0, w = 1, h = 1;
|
Evas_Coord x = 0, y = 0, w = 1, h = 1;
|
||||||
int ox, oy, ow, oh;
|
int ox, oy, ow, oh;
|
||||||
|
Eina_Bool img_no_resize = EINA_FALSE;
|
||||||
|
|
||||||
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
||||||
if (efl_isa(img, EFL_CANVAS_LAYOUT_CLASS))
|
if (efl_isa(img, EFL_CANVAS_LAYOUT_CLASS))
|
||||||
|
@ -202,9 +203,7 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img)
|
||||||
//Exception Case
|
//Exception Case
|
||||||
if ((iw == 0) || (ih == 0) || (ow == 0) || (oh == 0))
|
if ((iw == 0) || (ih == 0) || (ow == 0) || (oh == 0))
|
||||||
{
|
{
|
||||||
evas_object_resize(img, 0, 0);
|
img_no_resize = EINA_TRUE;
|
||||||
evas_object_resize(sd->hit_rect, 0, 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iw = ((double)iw) * sd->scale;
|
iw = ((double)iw) * sd->scale;
|
||||||
|
@ -306,6 +305,9 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
if (img_no_resize)
|
||||||
|
evas_object_geometry_set(img, 0, 0, 0, 0);
|
||||||
|
else
|
||||||
evas_object_geometry_set(img, x, y, w, h);
|
evas_object_geometry_set(img, x, y, w, h);
|
||||||
|
|
||||||
evas_object_geometry_set(sd->hit_rect, x, y, w, h);
|
evas_object_geometry_set(sd->hit_rect, x, y, w, h);
|
||||||
|
|
Loading…
Reference in New Issue