diff options
| author | ab <abdullah_ahmed@brown.edu> | 2020-02-09 18:10:26 -0500 |
|---|---|---|
| committer | ab <abdullah_ahmed@brown.edu> | 2020-02-09 18:10:26 -0500 |
| commit | cb140cb5387836de1e2287ed9519a132f0f9d28f (patch) | |
| tree | 0ba305217bb74429d9d6867422b219d64eabeca7 /src/client/views/animationtimeline/Track.tsx | |
| parent | cf291047a4ba25c0bf56cb3f4255ec9bc929e420 (diff) | |
kinda works
Diffstat (limited to 'src/client/views/animationtimeline/Track.tsx')
| -rw-r--r-- | src/client/views/animationtimeline/Track.tsx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx index 9f63b3562..69e65fbcf 100644 --- a/src/client/views/animationtimeline/Track.tsx +++ b/src/client/views/animationtimeline/Track.tsx @@ -81,10 +81,17 @@ export class Track extends React.Component<IProps> { //////////////////////////////// - getLastRegion = () => { - console.log(this.regions.length); - console.log((this.regions[this.regions.length - 1] as Doc).time); - return this.regions[this.regions.length - 1] as Doc; + getLastRegionTime = () => { + let lastTime:number = 0; + let lastRegion:(Doc | undefined); + DocListCast(this.regions).forEach(region => { + const time = NumCast(region.time); + if (lastTime <= time) { + lastTime = time; + lastRegion = region; + } + }); + return lastRegion ? lastTime + NumCast(lastRegion.duration) : 0; } /** |
