diff --git a/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp b/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp index 8ca0b0b07d32cd6feabe137ca8e7761f21d2e789..ba9bc368ad4e30fd65324e501c2e8a762de225a4 100644 --- a/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp +++ b/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp @@ -192,9 +192,6 @@ void SwiperPattern::OnModifyDone() StopTranslateAnimation(); StopSpringAnimation(); StopFadeAnimation(); - if (indicatorController_) { - indicatorController_->Stop(); - } currentOffset_ = 0.0f; mainSizeIsMeasured_ = false; itemPosition_.clear(); @@ -309,25 +306,14 @@ void SwiperPattern::InitSurfaceChangedCallback() if (!swiper) { return; } - swiper->StopPropertyTranslateAnimation(); - swiper->StopTranslateAnimation(); - swiper->StopSpringAnimation(); - swiper->StopFadeAnimation(); - if (swiper->indicatorController_) { - swiper->indicatorController_->Stop(); - } - swiper->currentOffset_ = 0.0f; - swiper->itemPosition_.clear(); - swiper->jumpIndex_ = swiper->currentIndex_; - auto swiperNode = swiper->GetHost(); - CHECK_NULL_VOID(swiperNode); - swiperNode->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF); - for (const auto& child : swiperNode->GetChildren()) { - if (child->GetTag() == V2::JS_LAZY_FOR_EACH_ETS_TAG) { - auto lazyForEachNode = AceType::DynamicCast(child); - CHECK_NULL_VOID(lazyForEachNode); - lazyForEachNode->SetFlagForGeneratedItem(PROPERTY_UPDATE_MEASURE); - } + if (type == WindowSizeChangeReason::ROTATION) { + swiper->StopPropertyTranslateAnimation(); + swiper->StopTranslateAnimation(); + swiper->StopSpringAnimation(); + swiper->StopFadeAnimation(); + swiper->currentOffset_ = 0.0f; + swiper->itemPosition_.clear(); + swiper->jumpIndex_ = swiper->currentIndex_; } }); LOGD("Add surface changed callback id %{public}d", callbackId); @@ -1562,7 +1548,8 @@ void SwiperPattern::PlayPropertyTranslateAnimation(float translate, int32_t next pipeline->AddAfterRenderTask([weak = WeakClaim(this), info, nextIndex = GetLoopIndex(nextIndex)]() { auto swiper = weak.Upgrade(); CHECK_NULL_VOID(swiper); - swiper->FireAnimationStartEvent(swiper->GetLoopIndex(swiper->currentIndex_), nextIndex, info); + swiper->FireAnimationStartEvent( + swiper->GetLoopIndex(swiper->currentIndex_), nextIndex, info); }); }