if (this.range.rolling) {
this.range.stopRolling();
}
before calling the setRange on line 534.
Maybe there could be an extra option passed to the focus function, like there is for zoom, if you think this might break the desired behaviour in other cases.
I have rollingMode turned on and focus is not working anymore (works fine without rolling mode).
I've looked into it and it's probably doing the range set and then immediately scrolls bak to follow the current time.
I have managed to actually get it working in my code, by calling:
timeline.range.stopRolling();
before i calltimeline.focus(id);
(in the above code
timeline
is the vis timeline instance)I think this could be fixed in the Timeline's
focus
function here https://github.com/visjs/vis-timeline/blob/3aefb0961acaa40b8000165a46084e8f46fe068f/lib/timeline/Timeline.js#L438 by just addingbefore calling the
setRange
on line 534. Maybe there could be an extra option passed to the focus function, like there is for zoom, if you think this might break the desired behaviour in other cases.