From c0426aeb6b746aedea31b4998b280502f9599f12 Mon Sep 17 00:00:00 2001 From: yeyinglong_admin Date: Sat, 31 Aug 2024 17:16:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=93=BE=E5=BC=8F=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E8=BE=B9=E7=BC=98=E5=9B=9E=E5=BC=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeyinglong_admin --- .../core/components_ng/pattern/list/list_pattern.cpp | 7 +++++++ .../components_ng/pattern/scrollable/scrollable_pattern.h | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frameworks/core/components_ng/pattern/list/list_pattern.cpp b/frameworks/core/components_ng/pattern/list/list_pattern.cpp index 5b692d33a48..53eb230fc0f 100644 --- a/frameworks/core/components_ng/pattern/list/list_pattern.cpp +++ b/frameworks/core/components_ng/pattern/list/list_pattern.cpp @@ -2007,6 +2007,13 @@ void ListPattern::ProcessDragUpdate(float dragOffset, int32_t source) } bool overDrag = (source == SCROLL_FROM_UPDATE) && (IsAtTop() || IsAtBottom()); chainAnimation_->SetDelta(-dragOffset, overDrag); + if (source == SCROLL_FROM_UPDATE && GetCanOverScroll()) { + float tempDelta = currentDelta_; + currentDelta_ -= dragOffset; + bool isAtEdge = IsAtTop() || IsAtBottom(); + currentDelta_ = tempDelta; + SetCanOverScroll(isAtEdge); + } } float ListPattern::GetChainDelta(int32_t index) const diff --git a/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.h b/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.h index 61b7a0c2389..18689c45e19 100644 --- a/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.h +++ b/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.h @@ -752,6 +752,9 @@ protected: return scrollOriginChild_.Upgrade(); } + void SetCanOverScroll(bool val); + bool GetCanOverScroll() const; + private: virtual void OnScrollEndCallback() {}; @@ -820,9 +823,6 @@ private: void ExecuteScrollFrameBegin(float& mainDelta, ScrollState state); - void SetCanOverScroll(bool val); - bool GetCanOverScroll() const; - void OnScrollEnd(); void ProcessSpringEffect(float velocity, bool needRestart = false); void SetEdgeEffect(EdgeEffect edgeEffect);