Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtesaak committed Jul 10, 2018
1 parent 41603b0 commit b20b7ee
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 37 deletions.
31 changes: 22 additions & 9 deletions dist/perfect-scrollbar.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,7 @@ var touch = function(i) {

function touchStart(e) {
console.log(i);
if (!i.settings.swipePropagation) {
e.stopPropagation();
}
resolveSwipePropagation(e);

if (!shouldHandle(e)) {
return;
Expand Down Expand Up @@ -1019,9 +1017,9 @@ var touch = function(i) {
}

function touchMove(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (shouldHandle(e)) {
var touch = getTouch(e);

Expand Down Expand Up @@ -1052,9 +1050,9 @@ var touch = function(i) {
}
}
function touchEnd(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (i.settings.swipeEasing) {
clearInterval(easingLoop);
easingLoop = setInterval(function() {
Expand All @@ -1080,6 +1078,21 @@ var touch = function(i) {
}, 10);
}
}

function resolveSwipePropagation(e) {
if (!i.settings.swipePropagation && (isXScrollbarOnEdge() || isYScrollbarOnEdge())) {
e.stopPropagation();
}
}

function isXScrollbarOnEdge() {
return i.scrollbarXActive && (i.reach.x === 'end' || i.reach.x === 'start');
}

function isYScrollbarOnEdge() {
return i.scrollbarYActive && (i.reach.y === 'end' || i.reach.y === 'start');
}

if (env.supportsTouch) {
i.event.bind(element, 'touchstart', touchStart);
i.event.bind(element, 'touchmove', touchMove);
Expand Down
31 changes: 22 additions & 9 deletions dist/perfect-scrollbar.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,7 @@ var touch = function(i) {

function touchStart(e) {
console.log(i);
if (!i.settings.swipePropagation) {
e.stopPropagation();
}
resolveSwipePropagation(e);

if (!shouldHandle(e)) {
return;
Expand Down Expand Up @@ -1017,9 +1015,9 @@ var touch = function(i) {
}

function touchMove(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (shouldHandle(e)) {
var touch = getTouch(e);

Expand Down Expand Up @@ -1050,9 +1048,9 @@ var touch = function(i) {
}
}
function touchEnd(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (i.settings.swipeEasing) {
clearInterval(easingLoop);
easingLoop = setInterval(function() {
Expand All @@ -1078,6 +1076,21 @@ var touch = function(i) {
}, 10);
}
}

function resolveSwipePropagation(e) {
if (!i.settings.swipePropagation && (isXScrollbarOnEdge() || isYScrollbarOnEdge())) {
e.stopPropagation();
}
}

function isXScrollbarOnEdge() {
return i.scrollbarXActive && (i.reach.x === 'end' || i.reach.x === 'start');
}

function isYScrollbarOnEdge() {
return i.scrollbarYActive && (i.reach.y === 'end' || i.reach.y === 'start');
}

if (env.supportsTouch) {
i.event.bind(element, 'touchstart', touchStart);
i.event.bind(element, 'touchmove', touchMove);
Expand Down
31 changes: 22 additions & 9 deletions dist/perfect-scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,7 @@ var touch = function(i) {

function touchStart(e) {
console.log(i);
if (!i.settings.swipePropagation) {
e.stopPropagation();
}
resolveSwipePropagation(e);

if (!shouldHandle(e)) {
return;
Expand Down Expand Up @@ -1023,9 +1021,9 @@ var touch = function(i) {
}

function touchMove(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (shouldHandle(e)) {
var touch = getTouch(e);

Expand Down Expand Up @@ -1056,9 +1054,9 @@ var touch = function(i) {
}
}
function touchEnd(e) {
if (!i.settings.swipePropagation) {
e.stopPropagation();
}

resolveSwipePropagation(e);

if (i.settings.swipeEasing) {
clearInterval(easingLoop);
easingLoop = setInterval(function() {
Expand All @@ -1084,6 +1082,21 @@ var touch = function(i) {
}, 10);
}
}

function resolveSwipePropagation(e) {
if (!i.settings.swipePropagation && (isXScrollbarOnEdge() || isYScrollbarOnEdge())) {
e.stopPropagation();
}
}

function isXScrollbarOnEdge() {
return i.scrollbarXActive && (i.reach.x === 'end' || i.reach.x === 'start');
}

function isYScrollbarOnEdge() {
return i.scrollbarYActive && (i.reach.y === 'end' || i.reach.y === 'start');
}

if (env.supportsTouch) {
i.event.bind(element, 'touchstart', touchStart);
i.event.bind(element, 'touchmove', touchMove);
Expand Down
Loading

0 comments on commit b20b7ee

Please sign in to comment.