aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/animationtimeline/Track.tsx
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2020-02-09 18:10:26 -0500
committerab <abdullah_ahmed@brown.edu>2020-02-09 18:10:26 -0500
commitcb140cb5387836de1e2287ed9519a132f0f9d28f (patch)
tree0ba305217bb74429d9d6867422b219d64eabeca7 /src/client/views/animationtimeline/Track.tsx
parentcf291047a4ba25c0bf56cb3f4255ec9bc929e420 (diff)
kinda works
Diffstat (limited to 'src/client/views/animationtimeline/Track.tsx')
-rw-r--r--src/client/views/animationtimeline/Track.tsx15
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;
}
/**