improve image base click

This commit is contained in:
lixianjing 2023-08-11 07:46:06 +08:00
parent 39ef0ec844
commit d17c9a8e69
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,8 @@
# 最新动态 # 最新动态
2023/08/11
* 优化image_base控件的点击逻辑只有当指针落下与抬起都在控件内才触发click事件(感谢泽武提供补丁)
2023/08/10 2023/08/10
* 完善progress bar的脏矩形(感谢智明提供补丁) * 完善progress bar的脏矩形(感谢智明提供补丁)
* 完善demoui text selector资源(感谢智明提供补丁) * 完善demoui text selector资源(感谢智明提供补丁)

View File

@ -40,10 +40,12 @@ ret_t image_base_on_event(widget_t* widget, event_t* e) {
} }
break; break;
case EVT_POINTER_UP: { case EVT_POINTER_UP: {
pointer_event_t* up = pointer_event_cast(e);
if (image->pressed) { if (image->pressed) {
if (image->clickable || image->selectable) { if ((image->clickable || image->selectable) && widget_is_point_in(widget, up->x, up->y, FALSE)) {
pointer_event_t evt; pointer_event_t evt;
ret = widget_dispatch(widget, pointer_event_init(&evt, EVT_CLICK, widget, 0, 0)); ret = widget_dispatch(widget, pointer_event_init(&evt, EVT_CLICK, widget, up->x, up->y));
} }
if (!image->selectable) { if (!image->selectable) {