diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2019-04-01 11:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 11:35:41 +0200 |
commit | 85bab01fa80bf26272f65ea3638c5d6325beec54 (patch) | |
tree | aeb8224f298981962474593af28c1fd807090e61 /src | |
parent | 4afd76dd2a0ee3f2fecd3145ab3df871399bd245 (diff) | |
parent | eb70b7b31737b4ce0983e013f8f5a6f499b5da0e (diff) | |
download | svg.js-85bab01fa80bf26272f65ea3638c5d6325beec54.tar.gz svg.js-85bab01fa80bf26272f65ea3638c5d6325beec54.zip |
Merge pull request #966 from michAtEl/issue-964
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() } |