Procházet zdrojové kódy

Bug Fix: "is-visible" class was sometimes missing because of the clientWidth rounded error.

NaotoshiFujita před 5 roky
rodič
revize
5316a2a768

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

@@ -2025,10 +2025,11 @@ var STYLE_RESTORE_EVENTS = 'update.slide';
       var floor = Math.floor;
       var Components = Splide.Components;
       var Track = Components.Track;
-      var prop = Splide.options.direction === TTB ? 'clientHeight' : 'clientWidth';
+      var Layout = Components.Layout;
+      var isVertical = Splide.options.direction === TTB;
       var position = floor((Track.toPosition(index) + Track.offset(index) - Track.position) * Track.sign);
-      var edge = floor(position + slide[prop]);
-      var size = Components.Elements.track[prop];
+      var edge = floor(position + Layout[isVertical ? 'slideHeight' : 'slideWidth'](index));
+      var size = Layout[isVertical ? 'height' : 'width'];
       return 0 <= position && position <= size && 0 <= edge && edge <= size;
     },
 

+ 4 - 3
dist/js/splide.js

@@ -2015,10 +2015,11 @@ var STYLE_RESTORE_EVENTS = 'update.slide';
       var floor = Math.floor;
       var Components = Splide.Components;
       var Track = Components.Track;
-      var prop = Splide.options.direction === TTB ? 'clientHeight' : 'clientWidth';
+      var Layout = Components.Layout;
+      var isVertical = Splide.options.direction === TTB;
       var position = floor((Track.toPosition(index) + Track.offset(index) - Track.position) * Track.sign);
-      var edge = floor(position + slide[prop]);
-      var size = Components.Elements.track[prop];
+      var edge = floor(position + Layout[isVertical ? 'slideHeight' : 'slideWidth'](index));
+      var size = Layout[isVertical ? 'height' : 'width'];
       return 0 <= position && position <= size && 0 <= edge && edge <= size;
     },
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/js/splide.min.js


binární
dist/js/splide.min.js.gz


+ 4 - 3
src/js/components/elements/slide.js

@@ -142,10 +142,11 @@ export default ( Splide, index, realIndex, slide ) => {
 			const { floor }  = Math;
 			const Components = Splide.Components;
 			const Track      = Components.Track;
-			const prop       = Splide.options.direction === TTB ? 'clientHeight' : 'clientWidth';
+			const Layout     = Components.Layout;
+			const isVertical = Splide.options.direction === TTB;
 			const position   = floor( ( Track.toPosition( index ) + Track.offset( index ) - Track.position ) * Track.sign );
-			const edge       = floor( position + slide[ prop ] );
-			const size       = Components.Elements.track[ prop ];
+			const edge       = floor( position + Layout[ isVertical ? 'slideHeight' : 'slideWidth' ]( index ) );
+			const size       = Layout[ isVertical ? 'height' : 'width' ];
 
 			return ( 0 <= position && position <= size && 0 <= edge && edge <= size );
 		},

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů