From 09c005c385d698b6b80773a3e7371ba7f6600d17 Mon Sep 17 00:00:00 2001 From: Justabug Date: Sun, 30 Sep 2018 20:20:59 +0700 Subject: [PATCH] Addittional fix for page scrolling over timeline --- lib/timeline/Core.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index fa843ceff..067ef8a0e 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -226,18 +226,21 @@ Core.prototype._create = function (container) { // Don't preventDefault if you can't scroll if (!this.options.verticalScroll && !this.options.horizontalScroll) return; - // Prevent default actions caused by mouse wheel - // (else the page and timeline both scroll) - event.preventDefault(); - if (this.options.verticalScroll && Math.abs(deltaY) >= Math.abs(deltaX)) { var current = this.props.scrollTop; var adjusted = current + deltaY; if (this.isActive()) { - this._setScrollTop(adjusted); - this._redraw(); - this.emit('scroll', event); + var newScrollTop = this._setScrollTop(adjusted); + + if (newScrollTop !== current) { + this._redraw(); + this.emit('scroll', event); + + // Prevent default actions caused by mouse wheel + // (else the page and timeline both scroll) + event.preventDefault(); + } } } else if (this.options.horizontalScroll) { var delta = Math.abs(deltaX) >= Math.abs(deltaY) ? deltaX : deltaY; @@ -254,6 +257,8 @@ Core.prototype._create = function (container) { event: event }; this.range.setRange(newStart, newEnd, options); + + event.preventDefault(); } }