mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-18 02:41:37 +02:00
Adding more docs
This commit is contained in:
@@ -13,10 +13,29 @@ export default class Scroll {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.ws_ = wsInstance;
|
this.ws_ = wsInstance;
|
||||||
|
/**
|
||||||
|
* Where the scroll is going to happen. The WebSlides element.
|
||||||
|
* @type {Element}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.scrollContainer_ = wsInstance.el;
|
this.scrollContainer_ = wsInstance.el;
|
||||||
|
/**
|
||||||
|
* Whether movement is happening up or down.
|
||||||
|
* @type {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.isGoingUp_ = false;
|
this.isGoingUp_ = false;
|
||||||
|
/**
|
||||||
|
* Whether movement is happening left or right.
|
||||||
|
* @type {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.isGoingLeft_ = false;
|
this.isGoingLeft_ = false;
|
||||||
|
/**
|
||||||
|
* Timeout id holder.
|
||||||
|
* @type {?number}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.timeout_ = null;
|
this.timeout_ = null;
|
||||||
|
|
||||||
if (!MobileDetector.isAny()) {
|
if (!MobileDetector.isAny()) {
|
||||||
@@ -55,10 +74,14 @@ export default class Scroll {
|
|||||||
this.isGoingUp_ = wheelDeltaY < 0;
|
this.isGoingUp_ = wheelDeltaY < 0;
|
||||||
this.isGoingLeft_ = wheelDeltaX < 0;
|
this.isGoingLeft_ = wheelDeltaX < 0;
|
||||||
|
|
||||||
if (!this.ws_.isVertical) {
|
// If we're mainly moving horizontally, prevent default
|
||||||
// If we're mainly moving horizontally, prevent default
|
if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) {
|
||||||
if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) {
|
if (!this.ws_.isVertical) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
|
// If we're moving horizontally but this is vertical, return to avoid
|
||||||
|
// unwanted navigation.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user