提交 33b99b99 编写于 作者: H hdx

swiper: 优化蛇形线在快速连续滑动过程中抖动问题

上级 16903150
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
if (moveToIndex < 0) { moveToIndex = 0 } if (moveToIndex < 0) { moveToIndex = 0 }
if (moveToIndex > this.$swiperTabsRect.length - 1) { moveToIndex = this.$swiperTabsRect.length - 1 } if (moveToIndex > this.$swiperTabsRect.length - 1) { moveToIndex = this.$swiperTabsRect.length - 1 }
const percentage = Math.abs(offsetX) / this.$swiperWidth const percentage = Math.abs(offsetX % this.$swiperWidth) / this.$swiperWidth
const currentSize = this.$swiperTabsRect[currentIndex] const currentSize = this.$swiperTabsRect[currentIndex]
const moveToSize = this.$swiperTabsRect[moveToIndex] const moveToSize = this.$swiperTabsRect[moveToIndex]
const indicatorlineL = currentSize.left + (moveToSize.left - currentSize.left) * percentage const indicatorlineL = currentSize.left + (moveToSize.left - currentSize.left) * percentage
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
if (moveToIndex < 0) { moveToIndex = 0 } if (moveToIndex < 0) { moveToIndex = 0 }
if (moveToIndex > this.$swiperTabsRect.length - 1) { moveToIndex = this.$swiperTabsRect.length - 1 } if (moveToIndex > this.$swiperTabsRect.length - 1) { moveToIndex = this.$swiperTabsRect.length - 1 }
const percentage = Math.abs(offsetX) / this.$swiperWidth const percentage = Math.abs(offsetX % this.$swiperWidth) / this.$swiperWidth
const currentSize = this.$swiperTabsRect[currentIndex] const currentSize = this.$swiperTabsRect[currentIndex]
const moveToSize = this.$swiperTabsRect[moveToIndex] const moveToSize = this.$swiperTabsRect[moveToIndex]
const indicatorlineL = currentSize.left + (moveToSize.left - currentSize.left) * percentage const indicatorlineL = currentSize.left + (moveToSize.left - currentSize.left) * percentage
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册