回退 'Pull Request !44389 : 修复Swiper非循环时,ForEach缓存节点范围计算错误问题'

This commit is contained in:
xuzhidan 2024-09-29 08:46:09 +00:00 committed by Gitee
parent 1d40417e56
commit d15a504140
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -4507,12 +4507,6 @@ void SwiperPattern::SetLazyLoadFeature(bool useLazyLoad)
auto cacheCount = std::min(GetCachedCount(), RealTotalCount());
std::set<int32_t> forEachIndexSet;
for (auto count = 1; count <= cacheCount; count++) {
if (!IsLoop()) {
forEachIndexSet.emplace(std::min(GetLoopIndex(currentIndex_) + count, TotalCount() - 1));
forEachIndexSet.emplace(std::max(GetLoopIndex(currentIndex_) - count, 0));
continue;
}
forEachIndexSet.emplace(GetLoopIndex(currentIndex_ + count));
forEachIndexSet.emplace(GetLoopIndex(currentIndex_ - count));
}