Skip to content

Commit

Permalink
Merge pull request #40 from konami12/fixes
Browse files Browse the repository at this point in the history
FIX: El swipe era muy sencible en touch
  • Loading branch information
konami12 committed Jun 2, 2018
2 parents 18f38fa + 0642867 commit 887be61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orcaslide",
"version": "0.6.3",
"version": "0.6.4",
"description": "Slide basico",
"contributors": [
{
Expand Down
9 changes: 8 additions & 1 deletion source/OrcaSlide.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ class OrcaSlide {
const { contentItem, swipeConfig } = this.configSlide;
if (DEVICE !== "desktop") {
const SWIPE = swipeConfig;
let swipeLenght
contentItem.addEventListener("touchstart", (action) => {
const TOUCH = Utils.existFields(action, "touches.0", null);
swipeLenght = 0;
if (TOUCH) {
SWIPE.startX = TOUCH.screenX;
SWIPE.startY = TOUCH.screenY;
Expand All @@ -157,6 +159,9 @@ class OrcaSlide {
const TOUCH = Utils.existFields(action, "touches.0", null);
if (TOUCH) {
SWIPE.endX = TOUCH.screenX;
swipeLenght = (SWIPE.startX - SWIPE.endX >= 0)
? SWIPE.startX - SWIPE.endX
: (SWIPE.startX - SWIPE.endX) * -1;
SWIPE.endY = TOUCH.screenY;
SWIPE.direction = Utils.getDirecctionSlide(SWIPE);
}
Expand All @@ -165,7 +170,9 @@ class OrcaSlide {
contentItem.addEventListener("touchend", () => {
const IS_LEFT = (SWIPE.direction === "left");
this.autoPlay(false);
this.animateSlide(IS_LEFT);
if (swipeLenght > 60) {
this.animateSlide(IS_LEFT);
}
}, false);
}
}
Expand Down

0 comments on commit 887be61

Please sign in to comment.