mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-30 00:10:09 +02:00
Fixing wheel delta in Firefox
This commit is contained in:
@@ -85,6 +85,8 @@ export default class Scroll {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Firefox uses lines instead of pixels for delta
|
||||||
|
const linesToPx = event.deltaMode * this.ws_.options.minWheelDelta;
|
||||||
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);
|
const isHorizontalMovement = Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY);
|
||||||
@@ -103,8 +105,8 @@ export default class Scroll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(wheelDeltaY) >= this.ws_.options.minWheelDelta ||
|
if (Math.abs(wheelDeltaY + linesToPx) >= this.ws_.options.minWheelDelta ||
|
||||||
Math.abs(wheelDeltaX) >= this.ws_.options.minWheelDelta) {
|
Math.abs(wheelDeltaX + linesToPx) >= this.ws_.options.minWheelDelta) {
|
||||||
if ((isHorizontalMovement && this.isGoingLeft_) ||
|
if ((isHorizontalMovement && this.isGoingLeft_) ||
|
||||||
(!isHorizontalMovement && this.isGoingUp_)) {
|
(!isHorizontalMovement && this.isGoingUp_)) {
|
||||||
this.ws_.goPrev();
|
this.ws_.goPrev();
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* Name: WebSlides
|
* Name: WebSlides
|
||||||
* Version: 1.3.1
|
* Version: 1.3.1
|
||||||
* Date: 2017-06-28
|
* Date: 2017-06-29
|
||||||
* Description: Making HTML presentations easy
|
* Description: Making HTML presentations easy
|
||||||
* URL: https://github.com/webslides/webslides#readme
|
* URL: https://github.com/webslides/webslides#readme
|
||||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* Name: WebSlides
|
* Name: WebSlides
|
||||||
* Version: 1.3.1
|
* Version: 1.3.1
|
||||||
* Date: 2017-06-28
|
* Date: 2017-06-29
|
||||||
* Description: Making HTML presentations easy
|
* Description: Making HTML presentations easy
|
||||||
* URL: https://github.com/webslides/webslides#readme
|
* URL: https://github.com/webslides/webslides#readme
|
||||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||||
@@ -1998,6 +1998,8 @@ var Scroll = function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Firefox uses lines instead of pixels for delta
|
||||||
|
var linesToPx = event.deltaMode * this.ws_.options.minWheelDelta;
|
||||||
var wheelDeltaY = event.deltaY,
|
var wheelDeltaY = event.deltaY,
|
||||||
wheelDeltaX = event.deltaX;
|
wheelDeltaX = event.deltaX;
|
||||||
|
|
||||||
@@ -2017,7 +2019,7 @@ var Scroll = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(wheelDeltaY) >= this.ws_.options.minWheelDelta || Math.abs(wheelDeltaX) >= this.ws_.options.minWheelDelta) {
|
if (Math.abs(wheelDeltaY + linesToPx) >= this.ws_.options.minWheelDelta || Math.abs(wheelDeltaX + linesToPx) >= this.ws_.options.minWheelDelta) {
|
||||||
if (isHorizontalMovement && this.isGoingLeft_ || !isHorizontalMovement && this.isGoingUp_) {
|
if (isHorizontalMovement && this.isGoingLeft_ || !isHorizontalMovement && this.isGoingUp_) {
|
||||||
this.ws_.goPrev();
|
this.ws_.goPrev();
|
||||||
} else {
|
} else {
|
||||||
|
4
static/js/webslides.min.js
vendored
4
static/js/webslides.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user