react-responsive-carousel
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -146,2 +146,13 @@ /** @jsx React.DOM */ | ||
var delta = e.touches[0].pageX - this.state.touchStart; | ||
var leftBoundry = 0; | ||
var lastLeftBoundry = - this.itemSize * (this.props.items.length - 1); | ||
//if the first image meets the left boundry, prevent user from swiping left | ||
if (this.currentPosition === leftBoundry && delta > 0) { | ||
delta = 0; | ||
} | ||
//if the last image meets the left boundry, prevent user from swiping right | ||
if (this.currentPosition === lastLeftBoundry && delta < 0) { | ||
delta = 0; | ||
} | ||
// real position | ||
@@ -180,8 +191,14 @@ var position = this.currentPosition + delta; | ||
function () { | ||
// less than 0 means that it's going left | ||
if (this.touchPosition < 0) { | ||
this.slideLeft(); | ||
} else { | ||
this.slideRight(); | ||
} | ||
if (this.touchPosition === 0) { | ||
/* prevent users from swipe right on the first image | ||
but it goes to the opposite direction, as the delta is alwsys 0 | ||
when swipe right on the first image. | ||
also prevent users from swipe left on the last image from the same reason. | ||
*/ | ||
} else if (this.touchPosition < 0) { | ||
// less than 0 means that it's going left | ||
this.slideLeft(); | ||
} else if (this.touchPosition > 0) { | ||
this.slideRight(); | ||
} | ||
// discard the position | ||
@@ -188,0 +205,0 @@ this.touchPosition = null; |
{ | ||
"name": "react-responsive-carousel", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "React Responsive Carousel", | ||
@@ -5,0 +5,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72962
1190