1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-16 10:04:45 +02:00

Fixing issue with scrolling

This commit is contained in:
Antonio Laguna
2017-02-27 20:24:56 +01:00
parent 14e1b5b7b8
commit ebe42090ac
3 changed files with 10 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ export default class Scroll {
* @private
*/
onSlideChange_() {
this.timeout_ = setTimeout(() => { this.timeout_ = null; }, 500);
this.timeout_ = setTimeout(() => { this.timeout_ = null; }, 450);
}
/**
@@ -71,12 +71,13 @@ export default class Scroll {
}
const { deltaY: wheelDeltaY, deltaX: wheelDeltaX } = event;
const isVertical = this.ws_.isVertical;
this.isGoingUp_ = wheelDeltaY < 0;
this.isGoingLeft_ = wheelDeltaX < 0;
// If we're mainly moving horizontally, prevent default
if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) {
if (!this.ws_.isVertical) {
if (!isVertical) {
event.preventDefault();
} else {
// If we're moving horizontally but this is vertical, return to avoid
@@ -87,7 +88,8 @@ export default class Scroll {
if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA ||
Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) {
if (this.isGoingUp_ || this.isGoingLeft_) {
if (isVertical && this.isGoingUp_ ||
!isVertical && this.isGoingLeft_) {
this.ws_.goPrev();
} else {
this.ws_.goNext();

View File

@@ -1396,7 +1396,7 @@ var Scroll = function () {
this.timeout_ = setTimeout(function () {
_this.timeout_ = null;
}, 500);
}, 450);
}
/**
@@ -1417,12 +1417,13 @@ var Scroll = function () {
var wheelDeltaY = event.deltaY,
wheelDeltaX = event.deltaX;
var isVertical = this.ws_.isVertical;
this.isGoingUp_ = wheelDeltaY < 0;
this.isGoingLeft_ = wheelDeltaX < 0;
// If we're mainly moving horizontally, prevent default
if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) {
if (!this.ws_.isVertical) {
if (!isVertical) {
event.preventDefault();
} else {
// If we're moving horizontally but this is vertical, return to avoid
@@ -1432,7 +1433,7 @@ var Scroll = function () {
}
if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA || Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) {
if (this.isGoingUp_ || this.isGoingLeft_) {
if (isVertical && this.isGoingUp_ || !isVertical && this.isGoingLeft_) {
this.ws_.goPrev();
} else {
this.ws_.goNext();

File diff suppressed because one or more lines are too long