瀏覽代碼

Bug Fix: Sometimes swipe action made track move too much.

NaotoshiFujita 5 年之前
父節點
當前提交
07b00eade6
共有 3 個文件被更改,包括 5 次插入3 次删除
  1. 0 0
      dist/js/splide.min.js
  2. 二進制
      dist/js/splide.min.js.gz
  3. 5 3
      src/js/components/drag/index.js

文件差異過大導致無法顯示
+ 0 - 0
dist/js/splide.min.js


二進制
dist/js/splide.min.js.gz


+ 5 - 3
src/js/components/drag/index.js

@@ -251,13 +251,15 @@ export default ( Splide, Components ) => {
 
 			if ( absV > options.flickThreshold && Math.abs( info.offset[ axis ] ) < SWIPE_THRESHOLD ) {
 				destination += sign * Math.min( absV * options.flickPower, Layout.width * ( options.flickMaxPages || 1 ) );
-			} else {
-				// Do not allow the track to go to a previous position.
-				destination += sign * Layout.slideWidth / 2;
 			}
 
 			let index = Track.toIndex( destination );
 
+			// Do not allow the track to go to a previous position.
+			if ( index === Splide.index ) {
+				index += Controller.isRtl() ? sign : -sign;
+			}
+
 			if ( ! Splide.is( LOOP ) ) {
 				index = between( index, 0, Controller.edgeIndex );
 			}

部分文件因文件數量過多而無法顯示