Skip to content

Commit cf9934d

Browse files
bradhmarcortw
authored andcommitted
[Timeline] Modify redraw logic to treat scroll as needing restack. (visjs#2774)
This addresses visjs#1982 and visjs#1417. It possibly reduces performance, but correctness seems better.
1 parent e092933 commit cf9934d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/timeline/component/ItemSet.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,10 @@ ItemSet.prototype.redraw = function() {
616616
// TODO: would be nicer to get this as a trigger from Range
617617
var visibleInterval = range.end - range.start;
618618
var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth);
619-
if (zoomed) this.stackDirty = true;
619+
var scrolled = range.start != this.lastRangeStart;
620+
if (zoomed || scrolled) this.stackDirty = true;
620621
this.lastVisibleInterval = visibleInterval;
622+
this.lastRangeStart = range.start;
621623
this.props.lastWidth = this.props.width;
622624

623625
var restack = this.stackDirty;

0 commit comments

Comments
 (0)