aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionStackedTimeline.tsx16
-rw-r--r--src/client/views/nodes/AudioBox.tsx10
-rw-r--r--src/client/views/nodes/VideoBox.tsx9
3 files changed, 18 insertions, 17 deletions
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 21fbef1ac..801433151 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -29,6 +29,8 @@ export type CollectionStackedTimelineProps = {
playing: () => boolean;
setTime: (time: number) => void;
isChildActive: () => boolean;
+ startTag: string;
+ endTag: string;
};
@observer
@@ -85,13 +87,13 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
}
}
- anchorStart = (anchor: Doc) => NumCast(anchor.anchorStartTime, NumCast(anchor._timecodeToShow, NumCast(anchor.videoStart, NumCast(anchor.audioStart))));
- anchorEnd = (anchor: Doc, val: any = null) => NumCast(anchor.anchorEndTime, NumCast(anchor._timecodeToHide, NumCast(anchor.videoEnd, NumCast(anchor.audioEnd, val))));
+ anchorStart = (anchor: Doc) => NumCast(anchor._timecodeToShow, NumCast(anchor[this.props.startTag]));
+ anchorEnd = (anchor: Doc, val: any = null) => NumCast(anchor._timecodeToHide, NumCast(anchor[this.props.endTag]));
getLinkData(l: Doc) {
let la1 = l.anchor1 as Doc;
let la2 = l.anchor2 as Doc;
- const linkTime = NumCast(la2.anchorStartTime, NumCast(la1.anchorStartTime));
+ const linkTime = NumCast(la2[this.props.startTag], NumCast(la1[this.props.startTag]));
if (Doc.AreProtosEqual(la1, this.dataDoc)) {
la1 = l.anchor2 as Doc;
la2 = l.anchor1 as Doc;
@@ -108,8 +110,8 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
@action
changeAnchor = (anchor: Opt<Doc>, time: number) => {
if (anchor) {
- const timelineOnly = Cast(anchor.anchorStartTime, "number", null) !== undefined;
- if (timelineOnly) this._left ? anchor.anchorStartTime = time : anchor.anchorEndTime = time;
+ const timelineOnly = Cast(anchor[this.props.startTag], "number", null) !== undefined;
+ if (timelineOnly) this._left ? anchor[this.props.startTag] = time : anchor[this.props.endTag] = time;
else this._left ? anchor._timecodeToShow = time : anchor._timecodeToHide = time;
}
}
@@ -173,10 +175,10 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
title: ComputedField.MakeFunction(`"#" + formatToTime(self.anchorStartTime) + "-" + formatToTime(self.anchorEndTime)`) as any,
useLinkSmallAnchor: true,
hideLinkButton: true,
- anchorStartTime,
- anchorEndTime,
annotationOn: this.props.Document
});
+ anchor[this.props.startTag] = anchorStartTime;
+ anchor[this.props.endTag] = anchorEndTime;
if (Cast(this.dataDoc[this.props.fieldKey], listSpec(Doc), null) !== undefined) {
Cast(this.dataDoc[this.props.fieldKey], listSpec(Doc), []).push(anchor);
} else {
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index c8bec74fb..9d7c9bffc 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -26,13 +26,11 @@ import { FieldView, FieldViewProps } from './FieldView';
import { FormattedTextBoxComment } from "./formattedText/FormattedTextBoxComment";
import { LinkDocPreview } from "./LinkDocPreview";
declare class MediaRecorder {
- // whatever MediaRecorder has
- constructor(e: any);
+ constructor(e: any); // whatever MediaRecorder has
}
-export const audioSchema = createSchema({ playOnSelect: "boolean" });
-type AudioDocument = makeInterface<[typeof documentSchema, typeof audioSchema]>;
-const AudioDocument = makeInterface(documentSchema, audioSchema);
+type AudioDocument = makeInterface<[typeof documentSchema]>;
+const AudioDocument = makeInterface(documentSchema);
@observer
export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioDocument>(AudioDocument) {
@@ -352,6 +350,8 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
fieldKey={this.annotationKey}
renderDepth={this.props.renderDepth + 1}
parentActive={this.props.parentActive}
+ startTag={"audioStart"}
+ endTag={"auidioEnd"}
focus={emptyFunction}
styleProvider={this.props.styleProvider}
docFilters={this.props.docFilters}
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index a9c64b0bd..c1cf858c0 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -29,11 +29,8 @@ import { LinkDocPreview } from "./LinkDocPreview";
import "./VideoBox.scss";
const path = require('path');
-export const timeSchema = createSchema({
- _currentTimecode: "number", // the current time of a video or other linear, time-based document. Note, should really get set on an extension field, but that's more complicated when it needs to be set since the extension doc needs to be found first
-});
-type VideoDocument = makeInterface<[typeof documentSchema, typeof timeSchema]>;
-const VideoDocument = makeInterface(documentSchema, timeSchema);
+type VideoDocument = makeInterface<[typeof documentSchema]>;
+const VideoDocument = makeInterface(documentSchema);
@observer
export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoDocument>(VideoDocument) {
@@ -499,6 +496,8 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD
fieldKey={this.annotationKey}
renderDepth={this.props.renderDepth + 1}
parentActive={this.props.parentActive}
+ startTag={"videoStart"}
+ endTag={"videoEnd"}
focus={emptyFunction}
styleProvider={this.props.styleProvider}
docFilters={this.props.docFilters}