Browse Source

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

NaotoshiFujita 5 years ago
parent
commit
07b00eade6
3 changed files with 5 additions and 3 deletions
  1. 0 0
      dist/js/splide.min.js
  2. BIN
      dist/js/splide.min.js.gz
  3. 5 3
      src/js/components/drag/index.js

File diff suppressed because it is too large
+ 0 - 0
dist/js/splide.min.js


BIN
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 ) {
 			if ( absV > options.flickThreshold && Math.abs( info.offset[ axis ] ) < SWIPE_THRESHOLD ) {
 				destination += sign * Math.min( absV * options.flickPower, Layout.width * ( options.flickMaxPages || 1 ) );
 				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 );
 			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 ) ) {
 			if ( ! Splide.is( LOOP ) ) {
 				index = between( index, 0, Controller.edgeIndex );
 				index = between( index, 0, Controller.edgeIndex );
 			}
 			}

Some files were not shown because too many files changed in this diff