From d788f0fbafbf0270ea801eed14cc0996e1d6d7ab Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 23 Sep 2021 22:01:00 -0400 Subject: renamed props for stackedTimeline --- .../collections/CollectionStackedTimeline.tsx | 58 +++++++++++----------- src/client/views/nodes/AudioBox.tsx | 7 +-- src/client/views/nodes/VideoBox.tsx | 6 +-- 3 files changed, 36 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx index 12d70c05d..8b937c278 100644 --- a/src/client/views/collections/CollectionStackedTimeline.tsx +++ b/src/client/views/collections/CollectionStackedTimeline.tsx @@ -50,7 +50,7 @@ import { DragManager } from "../../util/DragManager"; type PanZoomDocument = makeInterface<[]>; const PanZoomDocument = makeInterface(); export type CollectionStackedTimelineProps = { - duration: number; + clipDuration: number; Play: () => void; Pause: () => void; playLink: (linkDoc: Doc) => void; @@ -67,7 +67,7 @@ export type CollectionStackedTimelineProps = { clipEnd: number; trimStart: () => number; trimEnd: () => number; - trimDuration: number; + trimDuration: () => number; setStartTrim: (newStart: number) => void; setEndTrim: (newEnd: number) => void; }; @@ -91,7 +91,7 @@ export class CollectionStackedTimeline extends CollectionSubView< get minLength() { const rect = this._timeline?.getBoundingClientRect(); if (rect) { - return 0.05 * this.duration; + return 0.05 * this.clipDuration; } return 0; } @@ -104,8 +104,8 @@ export class CollectionStackedTimeline extends CollectionSubView< return this.props.trimEnd(); } - get duration() { - return this.props.duration; + get clipDuration() { + return this.props.clipDuration; } @computed get currentTime() { @@ -116,8 +116,8 @@ export class CollectionStackedTimeline extends CollectionSubView<
); @@ -166,7 +166,7 @@ export class CollectionStackedTimeline extends CollectionSubView< toTimeline = (screen_delta: number, width: number) => { return Math.max( this.trimStart, - Math.min(this.trimEnd, (screen_delta / width) * this.props.trimDuration + this.trimStart)); + Math.min(this.trimEnd, (screen_delta / width) * this.props.trimDuration() + this.trimStart)); } rangeClickScript = () => CollectionStackedTimeline.RangeScript; @@ -283,10 +283,10 @@ export class CollectionStackedTimeline extends CollectionSubView< undefined, () => { !wasPlaying && - (this.props.trimming && this.duration ? - this.props.setTime(((clientX - rect.x) / rect.width) * this.duration) + (this.props.trimming && this.clipDuration ? + this.props.setTime(((clientX - rect.x) / rect.width) * this.clipDuration) : - this.props.setTime(((clientX - rect.x) / rect.width) * this.props.trimDuration + this.trimStart) + this.props.setTime(((clientX - rect.x) / rect.width) * this.props.trimDuration() + this.trimStart) ); } ); @@ -305,7 +305,7 @@ export class CollectionStackedTimeline extends CollectionSubView< if (rect && this.props.isContentActive()) { this.props.setStartTrim(Math.min( Math.max( - this.trimStart + (e.movementX / rect.width) * this.duration, + this.trimStart + (e.movementX / rect.width) * this.clipDuration, 0 ), this.trimEnd - this.minLength @@ -333,8 +333,8 @@ export class CollectionStackedTimeline extends CollectionSubView< if (rect && this.props.isContentActive()) { this.props.setEndTrim(Math.max( Math.min( - this.trimEnd + (e.movementX / rect.width) * this.duration, - this.props.clipStart + this.duration + this.trimEnd + (e.movementX / rect.width) * this.clipDuration, + this.props.clipStart + this.clipDuration ), this.trimStart + this.minLength )); @@ -344,7 +344,7 @@ export class CollectionStackedTimeline extends CollectionSubView< emptyFunction, action((e, doubleTap) => { if (doubleTap) { - this.props.setEndTrim(this.duration); + this.props.setEndTrim(this.clipDuration); } }) ); @@ -362,8 +362,8 @@ export class CollectionStackedTimeline extends CollectionSubView< const timelineContentWidth = this.props.PanelWidth(); for (let i = 0; i < docDragData.droppedDocuments.length; i++) { const d = Doc.GetProto(docDragData.droppedDocuments[i]); - d._timecodeToHide = x / timelineContentWidth * this.props.trimDuration + NumCast(d._timecodeToHide) - NumCast(d._timecodeToShow); - d._timecodeToShow = x / timelineContentWidth * this.props.trimDuration; + d._timecodeToHide = x / timelineContentWidth * this.props.trimDuration() + NumCast(d._timecodeToHide) - NumCast(d._timecodeToShow); + d._timecodeToShow = x / timelineContentWidth * this.props.trimDuration(); } return true; @@ -469,7 +469,7 @@ export class CollectionStackedTimeline extends CollectionSubView< const x1 = this.anchorStart(m); const x2 = this.anchorEnd( m, - x1 + (10 / timelineContentWidth) * this.duration + x1 + (10 / timelineContentWidth) * this.clipDuration ); let max = 0; const overlappedLevels = new Set( @@ -544,7 +544,7 @@ export class CollectionStackedTimeline extends CollectionSubView<
@@ -642,14 +642,14 @@ export class CollectionStackedTimeline extends CollectionSubView< <>
@@ -666,8 +666,8 @@ export class CollectionStackedTimeline extends CollectionSubView<
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx index 918933194..f6d6ff440 100644 --- a/src/client/views/nodes/AudioBox.tsx +++ b/src/client/views/nodes/AudioBox.tsx @@ -546,6 +546,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent< timelineWidth = () => this.props.PanelWidth() - AudioBox.playheadWidth; trimEndFunc = () => this.trimEnd; trimStartFunc = () => this.trimStart; + trimDurationFunc = () => this.trimDuration; @computed get renderTimeline() { return ( diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 2485e7658..8b33842ff 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -538,8 +538,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent -- cgit v1.2.3-70-g09d2