From eb70b7b31737b4ce0983e013f8f5a6f499b5da0e Mon Sep 17 00:00:00 2001 From: Michael Becker <2890610-mich_at_el@users.noreply.gitlab.com> Date: Sat, 23 Feb 2019 23:55:09 +0100 Subject: bugfix for issue 964 --- src/animation/Timeline.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/animation/Timeline.js b/src/animation/Timeline.js index 66ba61f..d09deef 100644 --- a/src/animation/Timeline.js +++ b/src/animation/Timeline.js @@ -118,6 +118,20 @@ export default class Timeline extends EventTarget { return lastStartTime + lastDuration } + getEndTimeOfTimeline () { + let lastEndTime = 0 + for (var i = 0; i < this._runners.length; i++) { + let runnerInfo = this._runners[i] + var duration = runnerInfo ? runnerInfo.runner.duration() : 0 + var startTime = runnerInfo ? runnerInfo.start : 0 + let endTime = startTime + duration + if (endTime > lastEndTime) { + lastEndTime = endTime + } + } + return lastEndTime + } + // Makes sure, that after pausing the time doesn't jump updateTime () { if (!this.active()) { @@ -145,7 +159,7 @@ export default class Timeline extends EventTarget { finish () { // Go to end and pause - this.time(this.getEndTime() + 1) + this.time(this.getEndTimeOfTimeline() + 1) return this.pause() } -- cgit v1.2.3