From 77c2217b9f7863ab2ed70db67fa69fd254616d05 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Sat, 15 Jun 2024 22:07:21 +0800 Subject: [PATCH] improve list view --- docs/changes.md | 3 +++ src/ext_widgets/scroll_view/children_layouter_list_view.c | 6 ++++-- src/ext_widgets/scroll_view/list_view.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index 01a4a5838..1517011af 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,5 +1,8 @@ # 最新动态 +2024/06/15 + * 修复list_view的等于虚高也出现滚动条的问题和修改悬浮滚动条不再影响scroll_view的宽度(感谢智明提供补丁) + 2024/06/14 * 给widget_visible_in_scroll_view.inc增加注释和修复默认滚动规则的算法(感谢智明提供补丁) * 修复3key5key页面不能自动聚焦的功能(感谢智明提供补丁) diff --git a/src/ext_widgets/scroll_view/children_layouter_list_view.c b/src/ext_widgets/scroll_view/children_layouter_list_view.c index a2188a47f..8424545a9 100644 --- a/src/ext_widgets/scroll_view/children_layouter_list_view.c +++ b/src/ext_widgets/scroll_view/children_layouter_list_view.c @@ -377,7 +377,9 @@ static int32_t children_layouter_list_view_for_list_view_get_scroll_view_w(list_ widget_t* scroll_bar = NULL; return_value_if_fail(list_view != NULL && scroll_view != NULL, 0); scroll_bar = list_view->scroll_bar; - if (list_view->floating_scroll_bar || scroll_bar == NULL || scroll_bar_is_mobile(scroll_bar) || + if (list_view->floating_scroll_bar) { + scroll_view_w = scroll_view->w; + } else if (scroll_bar == NULL || scroll_bar_is_mobile(scroll_bar) || (!scroll_bar_is_mobile(scroll_bar) && list_view->auto_hide_scroll_bar && scroll_view->h >= virtual_h)) { scroll_view_w = list_view->widget.w; @@ -452,7 +454,7 @@ static ret_t children_layouter_list_view_for_list_view_set_scroll_bar_info(widge } else { if (scroll_view->h >= virtual_h) { scroll_bar_set_value(widget, 0); - if (list_view->auto_hide_scroll_bar || list_view->floating_scroll_bar) { + if (list_view->auto_hide_scroll_bar) { widget_set_sensitive(widget, FALSE); widget_set_visible_only(widget, FALSE); } else { diff --git a/src/ext_widgets/scroll_view/list_view.c b/src/ext_widgets/scroll_view/list_view.c index 03d1bc5cc..e4117342a 100644 --- a/src/ext_widgets/scroll_view/list_view.c +++ b/src/ext_widgets/scroll_view/list_view.c @@ -110,7 +110,7 @@ static bool_t list_view_is_play_floating_scroll_bar_animtion(list_view_t* list_v scroll_view = SCROLL_VIEW(list_view->scroll_view); return_value_if_fail(scroll_view != NULL, FALSE); - if (list_view->floating_scroll_bar && scroll_view->virtual_h >= list_view->widget.h) { + if (list_view->floating_scroll_bar && scroll_view->virtual_h > list_view->widget.h) { return TRUE; } }