react-multi-carousel
Advanced tools
Comparing version 1.0.27 to 1.0.28
@@ -108,2 +108,12 @@ "use strict"; | ||
} | ||
else if (slidesHavePassed > 0 && | ||
this.state.currentSlide + 1 + slidesToShow <= this.state.totalItems) { | ||
// prevent over sliding; | ||
const maxSlides = this.state.totalItems - slidesToShow; | ||
const maxPosition = -(this.state.itemWidth * maxSlides); | ||
this.setState({ | ||
transform: maxPosition, | ||
currentSlide: maxSlides | ||
}); | ||
} | ||
else { | ||
@@ -128,2 +138,10 @@ if (infinite) { | ||
} | ||
else if (slidesHavePassed > 0 && | ||
this.state.currentSlide - slidesToSlide >= 0) { | ||
// prevent oversliding. | ||
this.setState({ | ||
transform: 0, | ||
currentSlide: 0 | ||
}); | ||
} | ||
else { | ||
@@ -195,7 +213,7 @@ const maxSlides = this.state.totalItems - slidesToShow; | ||
1; | ||
this.next(hasTravel === 0 || hasTravel === 1 ? 0 : hasTravel - 1); | ||
this.next(hasTravel); | ||
} | ||
if (e.pageX > this.initialPosition) { | ||
const hasTravel = Math.round((e.pageX - this.initialPosition) / this.state.itemWidth); | ||
this.previous(hasTravel === 0 || hasTravel === 1 ? 0 : hasTravel - 1); | ||
this.previous(hasTravel); | ||
} | ||
@@ -249,7 +267,7 @@ this.resetMoveStatus(); | ||
const hasTravel = Math.round((this.initialPosition - this.lastPosition) / this.state.itemWidth); | ||
this.next(hasTravel === 1 ? 0 : hasTravel - 1); | ||
this.next(hasTravel); | ||
} | ||
if (this.direction === "left") { | ||
const hasTravel = Math.round((this.lastPosition - this.initialPosition) / this.state.itemWidth); | ||
this.previous(hasTravel === 1 ? 0 : hasTravel - 1); | ||
this.previous(hasTravel); | ||
} | ||
@@ -256,0 +274,0 @@ this.resetMoveStatus(); |
{ | ||
"name": "react-multi-carousel", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
39458
512