aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/StyleProvider.tsx2
-rw-r--r--src/client/views/collections/CollectionStackedTimeline.tsx8
-rw-r--r--src/client/views/nodes/AudioBox.tsx8
-rw-r--r--src/client/views/nodes/PresBox.tsx6
-rw-r--r--src/client/views/nodes/VideoBox.tsx4
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx2
-rw-r--r--src/fields/documentSchemas.ts2
7 files changed, 15 insertions, 17 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index 803390055..3956b8c5b 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -141,7 +141,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps |
`${darkScheme() ? "rgb(30, 32, 31) " : "#9c9396 "} ${StrCast(doc.boxShadow, "0.2vw 0.2vw 0.8vw")}`);
case DocumentType.LABEL:
- if (doc?.anchorStartTime !== undefined) return "black 2px 2px 1px";
+ if (doc?.annotationOn !== undefined) return "black 2px 2px 1px";
default:
return doc.z ? `#9c9396 ${StrCast(doc?.boxShadow, "10px 10px 0.9vw")}` : // if it's a floating doc, give it a big shadow
props?.ContainingCollectionDoc?._useClusters && doc.type !== DocumentType.INK ? (`${backgroundCol()} ${StrCast(doc.boxShadow, `0vw 0vw ${(isBackground() ? 100 : 50) / (docProps?.ContentScaling?.() || 1)}px`)}`) : // if it's just in a cluster, make the shadown roughly match the cluster border extent
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 893f2c53b..1d7e40e96 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -88,7 +88,7 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
}
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]));
+ anchorEnd = (anchor: Doc, val: any = null) => NumCast(anchor._timecodeToHide, NumCast(anchor[this.props.endTag], val));
getLinkData(l: Doc) {
let la1 = l.anchor1 as Doc;
@@ -111,7 +111,7 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
changeAnchor = (anchor: Opt<Doc>, time: number) => {
if (anchor) {
const timelineOnly = Cast(anchor[this.props.startTag], "number", null) !== undefined;
- if (timelineOnly) this._left ? anchor[this.props.startTag] = time : anchor[this.props.endTag] = time;
+ if (timelineOnly) Doc.SetInPlace(anchor, this._left ? this.props.startTag : this.props.endTag, time, true);
else this._left ? anchor._timecodeToShow = time : anchor._timecodeToHide = time;
}
}
@@ -177,8 +177,8 @@ export class CollectionStackedTimeline extends CollectionSubView<PanZoomDocument
hideLinkButton: true,
annotationOn: this.props.Document
});
- anchor[this.props.startTag] = anchorStartTime;
- anchor[this.props.endTag] = anchorEndTime;
+ Doc.GetProto(anchor)[this.props.startTag] = anchorStartTime;
+ Doc.GetProto(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 9d7c9bffc..741a03900 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -81,7 +81,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
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 = this._stackedTimeline.current?.anchorStart(la2) || this._stackedTimeline.current?.anchorStart(la1);
if (Doc.AreProtosEqual(la1, this.dataDoc)) {
la1 = l.anchor2 as Doc;
la2 = l.anchor1 as Doc;
@@ -334,8 +334,8 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
else {
this.links.filter(l => l.anchor1 === link || l.anchor2 === link).forEach(l => {
const { la1, la2 } = this.getLinkData(l);
- const startTime = NumCast(la1.anchorStartTime, NumCast(la2.anchorStartTime, null));
- const endTime = NumCast(la1.anchorEndTime, NumCast(la2.anchorEndTime, null));
+ const startTime = this._stackedTimeline.current?.anchorStart(la1) || this._stackedTimeline.current?.anchorStart(la2);
+ const endTime = this._stackedTimeline.current?.anchorEnd(la1) || this._stackedTimeline.current?.anchorEnd(la2);
if (startTime !== undefined) {
if (this.layoutDoc.playOnSelect) endTime ? this.playFrom(startTime, endTime) : this.playFrom(startTime);
else this._ele!.currentTime = this.layoutDoc._currentTimecode = startTime;
@@ -351,7 +351,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
renderDepth={this.props.renderDepth + 1}
parentActive={this.props.parentActive}
startTag={"audioStart"}
- endTag={"auidioEnd"}
+ endTag={"audioEnd"}
focus={emptyFunction}
styleProvider={this.props.styleProvider}
docFilters={this.props.docFilters}
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 8d0283a12..b6feace12 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -715,9 +715,9 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
if (audio) {
audio.mediaStart = "manual";
audio.mediaStop = "manual";
- audio.presStartTime = NumCast(doc.anchorStartTime);
- audio.presEndTime = NumCast(doc.anchorEndTime);
- audio.presDuration = NumCast(doc.anchorEndTime) - NumCast(doc.anchorStartTime);
+ audio.presStartTime = NumCast(doc.audioStart, NumCast(doc.videoStart));
+ audio.presEndTime = NumCast(doc.audioEnd, NumCast(doc.videoEnd));
+ audio.presDuration = audio.presStartTime - audio.presEndTime;
TabDocView.PinDoc(audio, { audioRange: true });
setTimeout(() => this.removeDocument(doc), 0);
return false;
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index c1cf858c0..ee5fffcc6 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -480,8 +480,8 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD
}
playLink = (doc: Doc) => {
- const startTime = NumCast(doc.anchorStartTime, NumCast(doc._timecodeToShow));
- const endTime = NumCast(doc.anchorEndTime, NumCast(doc._timecodeToHide, null));
+ const startTime = this._stackedTimeline.current?.anchorStart(doc) || 0;
+ const endTime = this._stackedTimeline.current?.anchorEnd(doc);
if (startTime !== undefined) {
if (this.layoutDoc.playOnSelect) endTime ? this.playFrom(startTime, endTime) : this.playFrom(startTime);
else this.Seek(startTime);
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 36d268fe9..96c34860b 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -361,7 +361,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
DocListCast(this.dataDoc.links).map((l, i) => {
let la1 = l.anchor1 as Doc;
let la2 = l.anchor2 as Doc;
- this._linkTime = NumCast(la1.anchorStartTime, NumCast(la2.anchorStartTime));
+ this._linkTime = NumCast(la1.audioStart, NumCast(la2.audioStart));
audioState = la2.audioState;
if (Doc.AreProtosEqual(la2, this.dataDoc)) {
la1 = l.anchor2 as Doc;
diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts
index d52f3a928..b10c2b015 100644
--- a/src/fields/documentSchemas.ts
+++ b/src/fields/documentSchemas.ts
@@ -21,8 +21,6 @@ export const documentSchema = createSchema({
_currentTimecode: "number", // current play back time of a temporal document (video / audio)
_timecodeToShow: "number", // the time that a document should be displayed (e.g., time an annotation should be displayed on a video)
isLabel: "boolean", // whether the document is a label or not (video / audio)
- anchorStartTime: "number", // the time code where a document activates (eg in Audio or video timelines)
- anchorEndTime: "number", // the time code where a document deactivates
markers: listSpec(Doc), // list of markers for audio / video
x: "number", // x coordinate when in a freeform view
y: "number", // y coordinate when in a freeform view