1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-30 08:21:15 +02:00

Fixing wheel delta in Firefox

This commit is contained in:
Luis
2017-06-29 11:33:01 +02:00
parent 811007da8d
commit 8e75227ea0
4 changed files with 11 additions and 7 deletions

View File

@@ -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();

View File

@@ -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

View File

@@ -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 {

File diff suppressed because one or more lines are too long