mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
rollback widget_to_screen change
This commit is contained in:
parent
04f77c266e
commit
c7e2dee515
@ -2,6 +2,7 @@
|
||||
|
||||
2023/05/25
|
||||
* 修改widget的xoffset 或 yoffset != 0时widget\_is\_point\_in结果不正确的问题(感谢朝泽提供补丁)
|
||||
* 回退之前的 widget\_to\_screen 的修改,增加了测试用例,确保 widget\_to\_screen 和widget\_to\_loacl 配对转化(感谢智明提供补丁)
|
||||
|
||||
2023/05/24
|
||||
* 完善编译脚本(感谢朝泽提供补丁)
|
||||
|
@ -3712,7 +3712,7 @@ ret_t widget_to_screen_ex(widget_t* widget, widget_t* parent, point_t* p) {
|
||||
|
||||
while (iter != NULL && iter != parent) {
|
||||
xy_t offset_x, offset_y;
|
||||
if (iter != widget && widget_get_offset(iter, &offset_x, &offset_y) == RET_OK) {
|
||||
if (widget_get_offset(iter, &offset_x, &offset_y) == RET_OK) {
|
||||
p->x -= offset_x;
|
||||
p->y -= offset_y;
|
||||
}
|
||||
|
@ -1597,3 +1597,20 @@ TEST(Widget, dirty_rect_prop) {
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Widget, widget_to_screen_and_loacl) {
|
||||
widget_t* w = window_create(NULL, 0, 0, 400, 300);
|
||||
widget_t* sv = scroll_view_create(w, 10, 10, 100, 100);
|
||||
|
||||
point_t p = {10, 10};
|
||||
|
||||
scroll_view_set_virtual_w(sv, 1000);
|
||||
scroll_view_set_virtual_h(sv, 1000);
|
||||
scroll_view_set_offset(sv, 100, 100);
|
||||
ASSERT_EQ(widget_to_local(sv, &p), RET_OK);
|
||||
ASSERT_EQ(widget_to_screen(sv, &p), RET_OK);
|
||||
ASSERT_EQ(p.x, 10);
|
||||
ASSERT_EQ(p.y, 10);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user