scrollview里面添加list,如果list item较少,滑动会有大片空白出现。 1022/1 1022/head
authorCaisking <3449750381@qq.com>
Thu, 26 Sep 2024 12:15:45 +0000 (20:15 +0800)
committerCaisking <3449750381@qq.com>
Thu, 26 Sep 2024 12:15:45 +0000 (20:15 +0800)
code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp

index 242f67e..6756905 100755 (executable)
@@ -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);
 }