From: Caisking <3449750381@qq.com> Date: Thu, 26 Sep 2024 12:15:45 +0000 (+0800) Subject: scrollview里面添加list,如果list item较少,滑动会有大片空白出现。 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1022%2Fhead;p=mirrors%2FFD230.git scrollview里面添加list,如果list item较少,滑动会有大片空白出现。 --- diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp index 242f67e9a..675690547 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp @@ -380,13 +380,35 @@ bool UIList::DragYInner(int16_t distance) } distance = CalculateElasticDragLen(reboundSize, offset, distance); } - if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < + if (childrenTail_->GetRelativeRect().GetBottom() < + (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { + distance = 0; + } else if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { distance = listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM) - childrenTail_->GetRelativeRect().GetBottom(); } } } + // } else { + // if (childrenTail_ != nullptr) { + // if (isElastic_ && (reboundSize > 0) && + // (childrenTail_->GetRelativeRect().GetBottom() < + // (listHeight - scrollBlankSize_ - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM)))) { + // int16_t offset = (listHeight - scrollBlankSize_ - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM)) + // - (childrenTail_->GetRelativeRect().GetBottom()); + // if (offset > reboundSize) { + // offset = reboundSize; + // } + // distance = CalculateElasticDragLen(reboundSize, offset, distance); + // } + // if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < + // (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { + // distance = listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM) + // - childrenTail_->GetRelativeRect().GetBottom(); + // } + // } + // } return MoveOffset(0, distance); }