Browse Source

Refactoring.

NaotoshiFujita 3 years ago
parent
commit
0cad6ff523

+ 1 - 3
dist/js/splide.js

@@ -2227,9 +2227,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
       if (isFree) {
         Controller.scroll(destination);
       } else if (Splide2.is(FADE)) {
-        var length = Splide2.length;
-        var index = Splide2.index + orient(sign(velocity));
-        Controller.go(rewind ? (index + length) % length : index);
+        Controller.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
       } else if (Splide2.is(SLIDE) && exceeded && rewind) {
         Controller.go(exceededLimit(true) ? ">" : "<");
       } else {

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


BIN
dist/js/splide.min.js.gz


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


+ 1 - 3
src/js/components/Drag/Drag.ts

@@ -231,9 +231,7 @@ export function Drag( Splide: Splide, Components: Components, options: Options )
     if ( isFree ) {
       Controller.scroll( destination );
     } else if ( Splide.is( FADE ) ) {
-      const { length } = Splide;
-      const index = Splide.index + orient( sign( velocity ) );
-      Controller.go( rewind ? ( index + length ) % length : index );
+      Controller.go( orient( sign( velocity ) ) < 0 ? ( rewind ? '<' : '-' ) : ( rewind ? '>' : '+' ) );
     } else if ( Splide.is( SLIDE ) && exceeded && rewind ) {
       Controller.go( exceededLimit( true ) ? '>' : '<' );
     } else {

+ 2 - 1
src/js/test/php/examples/fade.php

@@ -20,9 +20,10 @@ $settings = get_settings();
     document.addEventListener( 'DOMContentLoaded', function () {
       var splide = new Splide( '#splide01', {
         width: 800,
+	      direction: 'rtl',
         type : 'fade',
 	      rewind: false,
-	      // rewindByDrag: true,
+	      rewindByDrag: false,
 	      autoplay: true,
 	      interval: 1000,
         breakpoints: {

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