Skip to content

Commit

Permalink
Fix "mouse" touch events
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Nov 7, 2015
1 parent 1b33350 commit 8c418fd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ s.updateClickedSlide = function (e) {

var isTouched,
isMoved,
allowTouchCallbacks,
touchStartTime,
isScrolling,
currentTranslate,
Expand Down Expand Up @@ -1184,6 +1185,7 @@ s.onTouchStart = function (e) {

isTouched = true;
isMoved = false;
allowTouchCallbacks = true;
isScrolling = undefined;
startMoving = undefined;
s.touches.startX = startX;
Expand Down Expand Up @@ -1227,9 +1229,9 @@ s.onTouchMove = function (e) {
return;
}
}

s.emit('onTouchMove', s, e);

if (allowTouchCallbacks) {
s.emit('onTouchMove', s, e);
}
if (e.targetTouches && e.targetTouches.length > 1) return;

s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
Expand Down Expand Up @@ -1363,7 +1365,10 @@ s.onTouchMove = function (e) {
};
s.onTouchEnd = function (e) {
if (e.originalEvent) e = e.originalEvent;
s.emit('onTouchEnd', s, e);
if (allowTouchCallbacks) {
s.emit('onTouchEnd', s, e);
}
allowTouchCallbacks = false;
if (!isTouched) return;
//Return Grab Cursor
if (s.params.grabCursor && isMoved && isTouched) {
Expand Down

0 comments on commit 8c418fd

Please sign in to comment.