mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-22 21:03:23 +02:00
Fixing scroll bug
This commit is contained in:
@@ -72,11 +72,13 @@ export default class Scroll {
|
|||||||
|
|
||||||
const { deltaY: wheelDeltaY, deltaX: wheelDeltaX } = event;
|
const { deltaY: wheelDeltaY, deltaX: wheelDeltaX } = event;
|
||||||
const isVertical = this.ws_.isVertical;
|
const isVertical = this.ws_.isVertical;
|
||||||
|
const isHorizontalMovement = Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY);
|
||||||
this.isGoingUp_ = wheelDeltaY < 0;
|
this.isGoingUp_ = wheelDeltaY < 0;
|
||||||
this.isGoingLeft_ = wheelDeltaX < 0;
|
this.isGoingLeft_ = wheelDeltaX < 0;
|
||||||
|
|
||||||
|
|
||||||
// If we're mainly moving horizontally, prevent default
|
// If we're mainly moving horizontally, prevent default
|
||||||
if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) {
|
if (isHorizontalMovement) {
|
||||||
if (!isVertical) {
|
if (!isVertical) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else {
|
} else {
|
||||||
@@ -88,8 +90,8 @@ export default class Scroll {
|
|||||||
|
|
||||||
if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA ||
|
if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA ||
|
||||||
Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) {
|
Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) {
|
||||||
if (isVertical && this.isGoingUp_ ||
|
if ((isHorizontalMovement && this.isGoingLeft_) ||
|
||||||
!isVertical && this.isGoingLeft_) {
|
(!isHorizontalMovement && this.isGoingUp_)) {
|
||||||
this.ws_.goPrev();
|
this.ws_.goPrev();
|
||||||
} else {
|
} else {
|
||||||
this.ws_.goNext();
|
this.ws_.goNext();
|
||||||
|
Reference in New Issue
Block a user