Skip to content

Commit

Permalink
fix: vertical-scrolling to be out of sync (#834)
Browse files Browse the repository at this point in the history
* Update Core.js

Fixed flickering when scrolling at the end of the timeline, fixes #422

* Alternative fix for #238

Co-authored-by: Yotam Berkowitz <[email protected]>
  • Loading branch information
Sennahoi and yotamberk authored Jan 15, 2021
1 parent f262ce6 commit ae7d179
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/timeline/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ class Core {
function onMouseScrollSide(event) {
if (!me.options.verticalScroll) return;

if (me._isProgramaticallyScrolled) {
me._isProgramaticallyScrolled = false;
return;
}

event.preventDefault();
if (me.isActive()) {
const adjusted = -event.target.scrollTop;
Expand Down Expand Up @@ -957,7 +952,7 @@ class Core {
props.left.height = dom.left.offsetHeight;
props.right.height = dom.right.offsetHeight;
props.top.height = dom.top.clientHeight || -props.border.top;
props.bottom.height = dom.bottom.clientHeight || -props.border.bottom;
props.bottom.height = Math.round(dom.bottom.getBoundingClientRect().height) || dom.bottom.clientHeight || -props.border.bottom;

// TODO: compensate borders when any of the panels is empty.

Expand Down Expand Up @@ -1349,7 +1344,7 @@ class Core {
*/
_updateScrollTop() {
// recalculate the scrollTopMin
const scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero
const scrollTopMin = Math.min(this.props.centerContainer.height - this.props.border.top - this.props.border.bottom - this.props.center.height, 0); // is negative or zero
if (scrollTopMin != this.props.scrollTopMin) {
// in case of bottom orientation, change the scrollTop such that the contents
// do not move relative to the time axis at the bottom
Expand All @@ -1367,7 +1362,6 @@ class Core {
this.dom.left.parentNode.scrollTop = -this.props.scrollTop;
this.dom.right.parentNode.scrollTop = -this.props.scrollTop;
}
this._isProgramaticallyScrolled = true;
return this.props.scrollTop;
}

Expand Down

0 comments on commit ae7d179

Please sign in to comment.