Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

[Timeline] Addittional fix for page scrolling over timeline #4143

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lib/timeline/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -254,6 +257,8 @@ Core.prototype._create = function (container) {
event: event
};
this.range.setRange(newStart, newEnd, options);

event.preventDefault();
}
}

Expand Down