!38684 Swiper: hide fadeanimation when direction change during dragging

Merge pull request !38684 from Hu_zq/master
This commit is contained in:
openharmony_ci 2024-07-24 12:42:30 +00:00 committed by Gitee
commit 48b6afaa44
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 1 deletions

View File

@ -1967,6 +1967,10 @@ void SwiperPattern::InitPanEvent(const RefPtr<GestureEventHub>& gestureHub)
if (direction_ == GetDirection() && panEvent_) {
return;
}
// fade offset need to be reset when is still dragging
if (direction_ != GetDirection()) {
fadeOffset_ = 0.f;
}
direction_ = GetDirection();
auto actionStartTask = [weak = WeakClaim(this)](const GestureEvent& info) {

View File

@ -413,10 +413,14 @@ HWTEST_F(SwiperControllerTestNg, ShowNextShowPreviousChangeIndex008, TestSize.Le
* @tc.expected: Show ChangeIndex page
*/
EXPECT_TRUE(VerifyChangeIndex(0, false, 0));
// expect 0
EXPECT_TRUE(VerifyChangeIndex(2, false, 2));
EXPECT_TRUE(VerifyChangeIndex(3, false, 3));
// expect 0
EXPECT_TRUE(VerifyChangeIndex(3, false, 0));
EXPECT_TRUE(VerifyChangeIndex(0, true, 0));
// expect 0
EXPECT_TRUE(VerifyChangeIndex(2, true, 1));
// expect 0
EXPECT_TRUE(VerifyChangeIndex(3, true, 1));
}