소스 검색

Bug Fix: The end index should not be clamped when the compact mode is not enabled.

Naotoshi Fujita 2 년 전
부모
커밋
ef791659b0

+ 1 - 1
dist/js/splide-renderer.min.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 4.0.17
+ * Version  : 4.0.18
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  */

+ 4 - 3
dist/js/splide.cjs.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 4.0.17
+ * Version  : 4.0.18
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  */
@@ -1294,7 +1294,7 @@ function Layout(Splide2, Components2, options) {
   }
 
   function sliderSize() {
-    return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, true);
+    return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0);
   }
 
   function getGap() {
@@ -1632,7 +1632,8 @@ function Controller(Splide2, Components2, options) {
 
   function scroll(destination, duration, snap, callback) {
     Components2.Scroll.scroll(destination, duration, snap, function () {
-      setIndex(min(loop(Move.toIndex(getPosition())), endIndex));
+      var index = loop(Move.toIndex(getPosition()));
+      setIndex(compact ? min(index, endIndex) : index);
       callback && callback();
     });
   }

+ 4 - 3
dist/js/splide.esm.js

@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 /*!
  * Splide.js
- * Version  : 4.0.17
+ * Version  : 4.0.18
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  */
@@ -1289,7 +1289,7 @@ function Layout(Splide2, Components2, options) {
   }
 
   function sliderSize() {
-    return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, true);
+    return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0);
   }
 
   function getGap() {
@@ -1627,7 +1627,8 @@ function Controller(Splide2, Components2, options) {
 
   function scroll(destination, duration, snap, callback) {
     Components2.Scroll.scroll(destination, duration, snap, function () {
-      setIndex(min(loop(Move.toIndex(getPosition())), endIndex));
+      var index = loop(Move.toIndex(getPosition()));
+      setIndex(compact ? min(index, endIndex) : index);
       callback && callback();
     });
   }

+ 3 - 2
dist/js/splide.js

@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 /*!
  * Splide.js
- * Version  : 4.0.17
+ * Version  : 4.0.18
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  */
@@ -1625,7 +1625,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
     function scroll(destination, duration, snap, callback) {
       Components2.Scroll.scroll(destination, duration, snap, function () {
-        setIndex(min(loop(Move.toIndex(getPosition())), endIndex));
+        var index = loop(Move.toIndex(getPosition()));
+        setIndex(compact ? min(index, endIndex) : index);
         callback && callback();
       });
     }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/js/splide.min.js


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


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/js/splide.min.js.map


+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "@splidejs/splide",
-  "version": "4.0.17",
+  "version": "4.0.18",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "@splidejs/splide",
-      "version": "4.0.17",
+      "version": "4.0.18",
       "license": "MIT",
       "devDependencies": {
         "@babel/core": "^7.18.13",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "4.0.17",
+  "version": "4.0.18",
   "description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
   "author": "Naotoshi Fujita",
   "license": "MIT",

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

@@ -151,7 +151,8 @@ export function Controller( Splide: Splide, Components: Components, options: Opt
    */
   function scroll( destination: number, duration?: number, snap?: boolean, callback?: AnyFunction ): void {
     Components.Scroll.scroll( destination, duration, snap, () => {
-      setIndex( min( loop( Move.toIndex( getPosition() ) ), endIndex ) );
+      const index = loop( Move.toIndex( getPosition() ) );
+      setIndex( compact ? min( index, endIndex ) : index );
       callback && callback();
     } );
   }

+ 2 - 2
src/js/test/php/examples/drag-free.php

@@ -19,8 +19,8 @@ $settings = get_settings();
   <script>
     document.addEventListener( 'DOMContentLoaded', function () {
       var splide = new Splide( '#splide01', {
-        perPage: 2,
-        gap    : '0.5em',
+        perPage: 3,
+        gap    : '2em',
         drag   : 'free',
 	      snap   : true,
         // height : 400,

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.