diff options
author | Michael Becker <2890610-mich_at_el@users.noreply.gitlab.com> | 2019-02-23 23:55:09 +0100 |
---|---|---|
committer | Michael Becker <2890610-mich_at_el@users.noreply.gitlab.com> | 2019-02-23 23:55:09 +0100 |
commit | eb70b7b31737b4ce0983e013f8f5a6f499b5da0e (patch) | |
tree | e7f555c9db9cece4f82d31edb567d17b81b6ce9b /src | |
parent | cc55c517277ed8314c9991d5bb74fda7bd04467a (diff) | |
download | svg.js-eb70b7b31737b4ce0983e013f8f5a6f499b5da0e.tar.gz svg.js-eb70b7b31737b4ce0983e013f8f5a6f499b5da0e.zip |
bugfix for issue 964
Diffstat (limited to 'src')
-rw-r--r-- | src/animation/Timeline.js | 16 |
1 files changed, 15 insertions, 1 deletions
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() } |