From 676cc1ef15653590eecf7f588fe02dd7d75863cc Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 23 Sep 2021 21:52:48 -0400
Subject: fixed trimming already trimmed clips.

---
 src/client/views/nodes/AudioBox.tsx | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'src/client/views/nodes/AudioBox.tsx')

diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index bde1a3d72..918933194 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -77,6 +77,8 @@ export class AudioBox extends ViewBoxAnnotatableComponent<
     @observable _trimming: boolean = false;
     @observable _trimStart: number = NumCast(this.layoutDoc.clipStart);
     @observable _trimEnd: number | undefined = Cast(this.layoutDoc.clipEnd, "number");
+    @computed get clipStart() { return NumCast(this.layoutDoc.clipStart); }
+    @computed get clipEnd() { return NumCast(this.layoutDoc.clipEnd, this.duration); }
     @computed get trimStart() { return this._trimming ? this._trimStart : NumCast(this.layoutDoc.clipStart); }
     @computed get trimEnd() {
         return this._trimming && this._trimEnd !== undefined ? this._trimEnd : NumCast(this.layoutDoc.clipEnd, this.duration);
@@ -181,9 +183,6 @@ export class AudioBox extends ViewBoxAnnotatableComponent<
 
         this.mediaState = this.path ? "paused" : undefined;
 
-        this.layoutDoc.clipStart = this.layoutDoc.clipStart ? this.layoutDoc.clipStart : 0;
-        this.layoutDoc.clipEnd = this.layoutDoc.clipEnd ? this.layoutDoc.clipEnd : this.duration ? this.duration : undefined;
-
         this.path && this.setAnchorTime(NumCast(this.layoutDoc.clipStart));
         this.path && this.timecodeChanged();
 
@@ -496,9 +495,6 @@ export class AudioBox extends ViewBoxAnnotatableComponent<
     // shows trim controls
     @action
     startTrim = () => {
-        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}
-- 
cgit v1.2.3-70-g09d2

