!42016 修复链式动效边缘回弹问题

Merge pull request !42016 from yeyinglong/listtest4
This commit is contained in:
openharmony_ci 2024-08-31 14:15:05 +00:00 committed by Gitee
commit 32aaf2524d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 3 deletions

View File

@ -2016,6 +2016,13 @@ void ListPattern::ProcessDragUpdate(float dragOffset, int32_t source)
} }
bool overDrag = (source == SCROLL_FROM_UPDATE) && (IsAtTop() || IsAtBottom()); bool overDrag = (source == SCROLL_FROM_UPDATE) && (IsAtTop() || IsAtBottom());
chainAnimation_->SetDelta(-dragOffset, overDrag); 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 float ListPattern::GetChainDelta(int32_t index) const

View File

@ -760,6 +760,9 @@ protected:
return scrollOriginChild_.Upgrade(); return scrollOriginChild_.Upgrade();
} }
void SetCanOverScroll(bool val);
bool GetCanOverScroll() const;
private: private:
virtual void OnScrollEndCallback() {}; virtual void OnScrollEndCallback() {};
@ -828,9 +831,6 @@ private:
void ExecuteScrollFrameBegin(float& mainDelta, ScrollState state); void ExecuteScrollFrameBegin(float& mainDelta, ScrollState state);
void SetCanOverScroll(bool val);
bool GetCanOverScroll() const;
void OnScrollEnd(); void OnScrollEnd();
void ProcessSpringEffect(float velocity, bool needRestart = false); void ProcessSpringEffect(float velocity, bool needRestart = false);
void SetEdgeEffect(EdgeEffect edgeEffect); void SetEdgeEffect(EdgeEffect edgeEffect);