!48652 修复滚动组件限位动画期间速度为0的问题

Merge pull request !48652 from honzx/1114contextBugfix
This commit is contained in:
openharmony_ci 2024-11-16 09:37:08 +00:00 committed by Gitee
commit 75fdf12518
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1217,7 +1217,7 @@ RefPtr<NodeAnimatablePropertyFloat> Scrollable::GetSnapProperty()
}
auto context = scroll->context_.Upgrade();
CHECK_NULL_VOID(context);
uint64_t currentVsync = scroll->context_.Upgrade();
uint64_t currentVsync = context->GetVsyncTime();
uint64_t diff = currentVsync - scroll->lastVsyncTime_;
if (diff < MAX_VSYNC_DIFF_TIME && diff > MIN_DIFF_VSYNC) {
scroll->snapVelocity_ = (position - scroll->currentPos_) / diff * MILLOS_PER_NANO_SECONDS;