mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve double click
This commit is contained in:
parent
21712ef2b2
commit
f35425bccb
@ -3,6 +3,7 @@
|
||||
2022/12/22
|
||||
* 公开函数 conf\_node\_find\_child\_by\_index(感谢俊杰提供补丁)
|
||||
* 修复combo\_box 只有一项 options 时,scroll\_bar layout 会打印警告的问题(感谢陈聪提供补丁)
|
||||
* 双击事件的判定加上限制坐标,防止在两个点之间快速来回点击也会触发双击事件(感谢陈聪提供补丁)
|
||||
|
||||
2022/12/19
|
||||
* 修复有圆角时的边框绘制(感谢兆坤提供补丁)。
|
||||
|
@ -298,13 +298,17 @@ static ret_t input_device_status_dispatch_input_event(input_device_status_t* ids
|
||||
case EVT_POINTER_UP: {
|
||||
if (dispatch || ids->pressed) {
|
||||
int32_t delta_time = e->time - ids->last_pointer_up_time;
|
||||
int32_t delta_x, delta_y;
|
||||
pointer_event_t* evt = (pointer_event_t*)e;
|
||||
pointer_event_rotate(evt, system_info());
|
||||
delta_x = evt->x - ids->last_pointer_up_x;
|
||||
delta_y = evt->y - ids->last_pointer_up_y;
|
||||
|
||||
input_device_status_init_pointer_event(ids, evt);
|
||||
widget_on_pointer_up(widget, evt);
|
||||
|
||||
if (delta_time < TK_DOUBLE_CLICK_TIME) {
|
||||
if (delta_time < TK_DOUBLE_CLICK_TIME && tk_abs(delta_x) < TK_DOUBLE_CLICK_XY &&
|
||||
tk_abs(delta_y) < TK_DOUBLE_CLICK_XY) {
|
||||
pointer_event_t double_click;
|
||||
e = pointer_event_init(&double_click, EVT_DOUBLE_CLICK, widget, evt->x, evt->y);
|
||||
widget_dispatch_event_to_target_recursive(widget, e);
|
||||
@ -315,6 +319,8 @@ static ret_t input_device_status_dispatch_input_event(input_device_status_t* ids
|
||||
ids->last_y = evt->y;
|
||||
ids->pressed = FALSE;
|
||||
ids->last_pointer_up_time = e->time;
|
||||
ids->last_pointer_up_x = evt->x;
|
||||
ids->last_pointer_up_y = evt->y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ typedef struct _input_device_status_t {
|
||||
|
||||
uint64_t last_pointer_down_time;
|
||||
uint64_t last_pointer_up_time;
|
||||
xy_t last_pointer_up_x;
|
||||
xy_t last_pointer_up_y;
|
||||
|
||||
widget_t* widget;
|
||||
uint32_t long_press_check_timer;
|
||||
|
@ -540,4 +540,9 @@ typedef struct _lcd_t lcd_t;
|
||||
#ifndef TK_DOUBLE_CLICK_TIME
|
||||
#define TK_DOUBLE_CLICK_TIME 300
|
||||
#endif /*TK_DOUBLE_CLICK_TIME*/
|
||||
|
||||
#ifndef TK_DOUBLE_CLICK_XY
|
||||
#define TK_DOUBLE_CLICK_XY 10
|
||||
#endif /*TK_DOUBLE_CLICK_XY*/
|
||||
|
||||
#endif /*TK_TYPES_DEF_H*/
|
||||
|
Loading…
Reference in New Issue
Block a user