Przeglądaj źródła

Revert "Bug Fix: Incorrect snap position."

This reverts commit 7b398835b7e362fd5e9d92d57511953ef1a64947.
Naotoshi Fujita 2 lat temu
rodzic
commit
17389422af

+ 1 - 1
dist/js/splide.cjs.js

@@ -1293,7 +1293,7 @@ function Layout(Splide2, Components2, options) {
   }
 
   function sliderSize() {
-    return totalSize(Splide2.length - 1, true) - totalSize(-1, true);
+    return totalSize(Splide2.length - 1, true) - totalSize(0, true) + slideSize(0, true);
   }
 
   function getGap() {

+ 1 - 1
dist/js/splide.esm.js

@@ -1288,7 +1288,7 @@ function Layout(Splide2, Components2, options) {
   }
 
   function sliderSize() {
-    return totalSize(Splide2.length - 1, true) - totalSize(-1, true);
+    return totalSize(Splide2.length - 1, true) - totalSize(0, true) + slideSize(0, true);
   }
 
   function getGap() {

+ 1 - 1
dist/js/splide.js

@@ -1286,7 +1286,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
     }
 
     function sliderSize() {
-      return totalSize(Splide2.length - 1, true) - totalSize(-1, true);
+      return totalSize(Splide2.length - 1, true) - totalSize(0, true) + slideSize(0, true);
     }
 
     function getGap() {

Plik diff jest za duży
+ 0 - 0
dist/js/splide.min.js


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


Plik diff jest za duży
+ 0 - 0
dist/js/splide.min.js.map


+ 2 - 2
package-lock.json

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

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

@@ -221,11 +221,12 @@ export function Layout( Splide: Splide, Components: Components, options: Options
 
   /**
    * Returns the slider size without clones before the first slide.
+   * Do not use the clone's size because it's unstable while initializing and refreshing process.
    *
    * @return The width or height of the slider without clones.
    */
   function sliderSize(): number {
-    return totalSize( Splide.length - 1, true ) - totalSize( -1, true );
+    return totalSize( Splide.length - 1, true ) - totalSize( 0, true ) + slideSize( 0, true );
   }
 
   /**

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików