Browse Source

Bug Fix: Slide width and height should be `null` for auto sizing.

NaotoshiFujita 3 years ago
parent
commit
eed205801b

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

@@ -1233,11 +1233,11 @@ function Layout(Splide2, Components2, options) {
   }
 
   function cssSlideWidth() {
-    return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
+    return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
   }
 
   function cssSlideHeight() {
-    return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight());
+    return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
   }
 
   function cssSlideSize() {

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

@@ -1228,11 +1228,11 @@ function Layout(Splide2, Components2, options) {
   }
 
   function cssSlideWidth() {
-    return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
+    return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
   }
 
   function cssSlideHeight() {
-    return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight());
+    return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
   }
 
   function cssSlideSize() {

+ 2 - 2
dist/js/splide.js

@@ -1227,11 +1227,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
     }
 
     function cssSlideWidth() {
-      return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
+      return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
     }
 
     function cssSlideHeight() {
-      return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight());
+      return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
     }
 
     function cssSlideSize() {

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


+ 4 - 4
src/js/components/Layout/Layout.ts

@@ -135,8 +135,8 @@ export function Layout( Splide: Splide, Components: Components, options: Options
    *
    * @return The width of the slide.
    */
-  function cssSlideWidth(): string {
-    return options.autoWidth ? '' : unit( options.fixedWidth ) || ( vertical ? '' : cssSlideSize() );
+  function cssSlideWidth(): string | null {
+    return options.autoWidth ? null : unit( options.fixedWidth ) || ( vertical ? '' : cssSlideSize() );
   }
 
   /**
@@ -144,9 +144,9 @@ export function Layout( Splide: Splide, Components: Components, options: Options
    *
    * @return The height of the slide.
    */
-  function cssSlideHeight(): string {
+  function cssSlideHeight(): string | null {
     return unit( options.fixedHeight )
-      || ( vertical ? ( options.autoHeight ? '' : cssSlideSize() ) : cssHeight() );
+      || ( vertical ? ( options.autoHeight ? null : cssSlideSize() ) : cssHeight() );
   }
 
   /**

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