Explorar o código

Bug Fix: Improve the timing when disabling arrows.

NaotoshiFujita %!s(int64=3) %!d(string=hai) anos
pai
achega
403ca4f9a5

+ 4 - 3
dist/js/splide.js

@@ -1654,14 +1654,15 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
       var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex);
       var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex);
 
 
       if (dest === -1 && Splide2.is(SLIDE)) {
       if (dest === -1 && Splide2.is(SLIDE)) {
+        var getLimit = Move.getLimit;
         var position = Move.getPosition();
         var position = Move.getPosition();
 
 
         if (prev) {
         if (prev) {
-          if (!approximatelyEqual(position, 0, 1)) {
+          if (!approximatelyEqual(position, getLimit(false), 1)) {
             return 0;
             return 0;
           }
           }
         } else {
         } else {
-          if (!approximatelyEqual(position, Move.getLimit(true), 1)) {
+          if (!approximatelyEqual(position, getLimit(true), 1)) {
             return getEnd();
             return getEnd();
           }
           }
         }
         }
@@ -1816,7 +1817,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 
     function listen() {
     function listen() {
       var go = Controller.go;
       var go = Controller.go;
-      on([EVENT_MOUNTED, EVENT_MOVE, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update);
+      on([EVENT_MOUNTED, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update);
       bind(next, "click", function () {
       bind(next, "click", function () {
         go(">", true);
         go(">", true);
       });
       });

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/js/splide.js.map


+ 1 - 1
src/js/components/Arrows/Arrows.ts

@@ -120,7 +120,7 @@ export function Arrows( Splide: Splide, Components: Components, options: Options
    */
    */
   function listen(): void {
   function listen(): void {
     const { go } = Controller;
     const { go } = Controller;
-    on( [ EVENT_MOUNTED, EVENT_MOVE, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED ], update );
+    on( [ EVENT_MOUNTED, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED ], update );
     bind( next, 'click', () => { go( '>', true ) } );
     bind( next, 'click', () => { go( '>', true ) } );
     bind( prev, 'click', () => { go( '<', true ) } );
     bind( prev, 'click', () => { go( '<', true ) } );
   }
   }

+ 3 - 2
src/js/components/Controller/Controller.ts

@@ -177,14 +177,15 @@ export function Controller( Splide: Splide, Components: Components, options: Opt
     const dest   = computeDestIndex( currIndex + number * ( prev ? -1 : 1 ), currIndex );
     const dest   = computeDestIndex( currIndex + number * ( prev ? -1 : 1 ), currIndex );
 
 
     if ( dest === -1 && Splide.is( SLIDE ) ) {
     if ( dest === -1 && Splide.is( SLIDE ) ) {
+      const { getLimit } = Move;
       const position = Move.getPosition();
       const position = Move.getPosition();
 
 
       if ( prev ) {
       if ( prev ) {
-        if ( ! approximatelyEqual( position, 0, 1 ) ) {
+        if ( ! approximatelyEqual( position, getLimit( false ), 1 ) ) {
           return 0;
           return 0;
         }
         }
       } else {
       } else {
-        if ( ! approximatelyEqual( position, Move.getLimit( true ), 1 ) ) {
+        if ( ! approximatelyEqual( position, getLimit( true ), 1 ) ) {
           return getEnd();
           return getEnd();
         }
         }
       }
       }

+ 3 - 1
src/js/test/php/examples/autoWidth.php

@@ -20,7 +20,8 @@ $settings = get_settings();
         // width     : 1000,
         // width     : 1000,
         autoWidth : true,
         autoWidth : true,
         gap       : '1rem',
         gap       : '1rem',
-        trimSpace : 'move',
+        trimSpace : false,
+        focus     : 'center',
         drag      : 'free',
         drag      : 'free',
       } );
       } );
 
 
@@ -28,6 +29,7 @@ $settings = get_settings();
 
 
       var splide02 = new Splide( '#splide02', {
       var splide02 = new Splide( '#splide02', {
         // width     : 1000,
         // width     : 1000,
+        type      : 'loop',
         autoWidth : true,
         autoWidth : true,
         gap       : '1rem',
         gap       : '1rem',
         focus     : 'center',
         focus     : 'center',

+ 1 - 1
src/js/test/php/examples/default.php

@@ -23,7 +23,7 @@ $settings = get_settings();
         perPage: 3,
         perPage: 3,
         // perMove: 1,
         // perMove: 1,
         gap    : '1.5rem',
         gap    : '1.5rem',
-        drag   : 'free',
+        // drag   : 'free',
         height : 200,
         height : 200,
       } );
       } );
 
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio