aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/Timeline.tsx
diff options
context:
space:
mode:
authorEleanor Eng <eleanor_eng@brown.edu>2019-05-11 16:12:17 -0400
committerEleanor Eng <eleanor_eng@brown.edu>2019-05-11 16:12:17 -0400
commit16a03ef298072c512eabddc4c9bd6405d9c29e4c (patch)
tree0e3aad024fee306e0f87318f67bb93519aa73d02 /src/client/views/nodes/Timeline.tsx
parent5a6e5dd5d653004ea16218e4d01bd8dfb285cebd (diff)
parent7ef63f53c1c7fdf23c7a18a37b67c49c97692db7 (diff)
temp commit
Diffstat (limited to 'src/client/views/nodes/Timeline.tsx')
-rw-r--r--src/client/views/nodes/Timeline.tsx19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/client/views/nodes/Timeline.tsx b/src/client/views/nodes/Timeline.tsx
index 14bcd738f..6fea51624 100644
--- a/src/client/views/nodes/Timeline.tsx
+++ b/src/client/views/nodes/Timeline.tsx
@@ -9,9 +9,9 @@ import { CollectionSubView, SubCollectionViewProps } from "../collections/Collec
import { DocumentViewProps } from "./DocumentView";
import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
-import { Doc } from "../../../new_fields/Doc";
-import { Document } from "../../../new_fields/Schema";
-import { FieldValue } from "../../../new_fields/Types";
+import { Doc, Self } from "../../../new_fields/Doc";
+import { Document, listSpec } from "../../../new_fields/Schema";
+import { FieldValue, Cast } from "../../../new_fields/Types";
@observer
export class Timeline extends CollectionSubView(Document) {
@@ -65,12 +65,17 @@ export class Timeline extends CollectionSubView(Document) {
this._currentBar = this.createBar(5);
this._inner.current.appendChild(this._currentBar);
}
- let doc: Document = this.props.Document;
- let childrenList = this.children;
+ let doc: Doc = this.props.Document;
+ let test = this.props.Document[this.props.fieldKey];
+ let children = Cast(this.props.Document[this.props.fieldKey], listSpec(Doc));
// let keyFrame = new KeyFrame(); //should not be done here...
// this._keyFrames.push(keyFrame)";
+ if (!children) {
+ return;
+ }
+ let childrenList = (children[Self] as any).__fields;
let keys = ["x", "y"];
- const addReaction = (element: Document) => {
+ const addReaction = (element: Doc) => {
return reaction(() => {
return keys.map(key => FieldValue(element[key]));
@@ -92,7 +97,7 @@ export class Timeline extends CollectionSubView(Document) {
}
});
};
- observe(childrenList as IObservableArray<Document>, change => {
+ observe(childrenList as IObservableArray<Doc>, change => {
if (change.type === "update") {
this._reactionDisposers[change.index]();
this._reactionDisposers[change.index] = addReaction(change.newValue);