mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
improve hscrollable
This commit is contained in:
parent
2ba951d1c6
commit
6f86cebc9e
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
2023/07/27
|
2023/07/27
|
||||||
* 修改克隆label控件时没有拷贝ellipses属性的问题(感谢朝泽提供补丁)
|
* 修改克隆label控件时没有拷贝ellipses属性的问题(感谢朝泽提供补丁)
|
||||||
* 修复克隆 rich_text 对象失败的问题(感谢智明提供补丁)
|
* 修复克隆 rich\_text 对象失败的问题(感谢智明提供补丁)
|
||||||
|
* 修复在 scrollable 的 tab\_button\_group 上面快速点击有概率会导致瞬移的问题(感谢智明提供补丁)
|
||||||
|
|
||||||
2023/07/26
|
2023/07/26
|
||||||
* 修改Windows下路径带中文时fs\_os\_get\_exe的返回结果不是utf8的问题(感谢朝泽提供补丁)
|
* 修改Windows下路径带中文时fs\_os\_get\_exe的返回结果不是utf8的问题(感谢朝泽提供补丁)
|
||||||
|
@ -169,8 +169,8 @@ ret_t hscrollable_on_event(hscrollable_t* hscrollable, event_t* e) {
|
|||||||
break;
|
break;
|
||||||
case EVT_POINTER_UP: {
|
case EVT_POINTER_UP: {
|
||||||
pointer_event_t* evt = (pointer_event_t*)e;
|
pointer_event_t* evt = (pointer_event_t*)e;
|
||||||
int32_t dx = evt->x - hscrollable->down.x;
|
int32_t dx = tk_abs(evt->x - hscrollable->down.x);
|
||||||
if (dx) {
|
if (dx > hscrollable->drag_threshold) {
|
||||||
hscrollable_on_pointer_up(hscrollable, (pointer_event_t*)e);
|
hscrollable_on_pointer_up(hscrollable, (pointer_event_t*)e);
|
||||||
}
|
}
|
||||||
hscrollable->dragged = FALSE;
|
hscrollable->dragged = FALSE;
|
||||||
@ -305,6 +305,7 @@ hscrollable_t* hscrollable_create(widget_t* widget) {
|
|||||||
|
|
||||||
hscrollable->widget = widget;
|
hscrollable->widget = widget;
|
||||||
hscrollable->enable_hscroll_animator = TRUE;
|
hscrollable->enable_hscroll_animator = TRUE;
|
||||||
|
hscrollable->drag_threshold = TK_DRAG_THRESHOLD;
|
||||||
|
|
||||||
return hscrollable;
|
return hscrollable;
|
||||||
}
|
}
|
||||||
@ -323,6 +324,13 @@ ret_t hscrollable_set_xoffset(hscrollable_t* hscrollable, int32_t xoffset) {
|
|||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret_t hscrollable_set_drag_threshold(hscrollable_t* hscrollable, uint32_t drag_threshold) {
|
||||||
|
return_value_if_fail(hscrollable != NULL, RET_BAD_PARAMS);
|
||||||
|
hscrollable->drag_threshold = drag_threshold;
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ret_t hscrollable_set_virtual_w(hscrollable_t* hscrollable, int32_t virtual_w) {
|
ret_t hscrollable_set_virtual_w(hscrollable_t* hscrollable, int32_t virtual_w) {
|
||||||
return_value_if_fail(hscrollable != NULL, RET_BAD_PARAMS);
|
return_value_if_fail(hscrollable != NULL, RET_BAD_PARAMS);
|
||||||
hscrollable->virtual_w = virtual_w;
|
hscrollable->virtual_w = virtual_w;
|
||||||
|
@ -40,6 +40,7 @@ typedef struct _hscrollable_t {
|
|||||||
int32_t xoffset_end;
|
int32_t xoffset_end;
|
||||||
int32_t xoffset_save;
|
int32_t xoffset_save;
|
||||||
int32_t virtual_w;
|
int32_t virtual_w;
|
||||||
|
uint32_t drag_threshold;
|
||||||
|
|
||||||
widget_t* widget;
|
widget_t* widget;
|
||||||
velocity_t velocity;
|
velocity_t velocity;
|
||||||
@ -51,6 +52,7 @@ typedef struct _hscrollable_t {
|
|||||||
hscrollable_t* hscrollable_create(widget_t* widget);
|
hscrollable_t* hscrollable_create(widget_t* widget);
|
||||||
ret_t hscrollable_set_xoffset(hscrollable_t* hscrollable, int32_t xoffset);
|
ret_t hscrollable_set_xoffset(hscrollable_t* hscrollable, int32_t xoffset);
|
||||||
ret_t hscrollable_set_virtual_w(hscrollable_t* hscrollable, int32_t virtual_w);
|
ret_t hscrollable_set_virtual_w(hscrollable_t* hscrollable, int32_t virtual_w);
|
||||||
|
ret_t hscrollable_set_drag_threshold(hscrollable_t* hscrollable, uint32_t drag_threshold);
|
||||||
ret_t hscrollable_set_always_scrollable(hscrollable_t* hscrollable, bool_t always_scrollable);
|
ret_t hscrollable_set_always_scrollable(hscrollable_t* hscrollable, bool_t always_scrollable);
|
||||||
ret_t hscrollable_set_enable_hscroll_animator(hscrollable_t* hscrollable,
|
ret_t hscrollable_set_enable_hscroll_animator(hscrollable_t* hscrollable,
|
||||||
bool_t enable_hscroll_animator);
|
bool_t enable_hscroll_animator);
|
||||||
|
Loading…
Reference in New Issue
Block a user