From 676cc1ef15653590eecf7f588fe02dd7d75863cc Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 23 Sep 2021 21:52:48 -0400 Subject: fixed trimming already trimmed clips. --- src/client/views/collections/CollectionStackedTimeline.tsx | 14 ++++++++------ src/client/views/nodes/AudioBox.tsx | 10 ++++------ src/client/views/nodes/VideoBox.tsx | 2 ++ 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx index 0985e5b2e..12d70c05d 100644 --- a/src/client/views/collections/CollectionStackedTimeline.tsx +++ b/src/client/views/collections/CollectionStackedTimeline.tsx @@ -63,6 +63,8 @@ export type CollectionStackedTimelineProps = { dictationKey: string; rawDuration: number; trimming: boolean; + clipStart: number; + clipEnd: number; trimStart: () => number; trimEnd: () => number; trimDuration: number; @@ -332,7 +334,7 @@ export class CollectionStackedTimeline extends CollectionSubView< this.props.setEndTrim(Math.max( Math.min( this.trimEnd + (e.movementX / rect.width) * this.duration, - this.duration + this.props.clipStart + this.duration ), this.trimStart + this.minLength )); @@ -582,7 +584,7 @@ export class CollectionStackedTimeline extends CollectionSubView< start + (10 / timelineContentWidth) * this.duration ); const left = this.props.trimming ? - (start / this.duration) * timelineContentWidth + ((start - this.props.clipStart) / this.duration) * timelineContentWidth : Math.max((start - this.trimStart) / this.props.trimDuration * timelineContentWidth, 0); const top = (d.level / maxLevel) * this.timelineContentHeight() + 15; const timespan = end - start; @@ -631,7 +633,7 @@ export class CollectionStackedTimeline extends CollectionSubView< className="collectionStackedTimeline-current" style={{ left: this.props.trimming - ? `${(this.currentTime / this.duration) * 100}%` + ? `${((this.currentTime - this.props.clipStart) / this.duration) * 100}%` : `${(this.currentTime - this.trimStart) / (this.trimEnd - this.trimStart) * 100}%`, }} /> @@ -640,13 +642,13 @@ export class CollectionStackedTimeline extends CollectionSubView< <>
{ - if (!this.duration) { - this.timecodeChanged(); - } if (this.mediaState === "playing") { this.Pause(); } @@ -581,6 +577,8 @@ export class AudioBox extends ViewBoxAnnotatableComponent< playLink={this.playLink} PanelWidth={this.timelineWidth} PanelHeight={this.timelineHeight} + clipStart={this.clipStart} + clipEnd={this.clipEnd} trimming={this._trimming} trimStart={this.trimStartFunc} trimEnd={this.trimEndFunc} diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 84eeacc29..2485e7658 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -551,6 +551,8 @@ export class VideoBox extends ViewBoxAnnotatableComponent