aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-23 11:16:53 -0400
committerbobzel <zzzman@gmail.com>2021-09-23 11:16:53 -0400
commitbafc47fe100002e37c7abcada3dc44f3bfb66f62 (patch)
tree4522253f889f1ea73667ea6ae9d1b09a80f133ef /src/client/views/collections
parentfdb55f95c79d568395a6a106248b0901c67bdb1e (diff)
a bunch of fixes to audio timelines to support undoing clips, simplifying audioWaveform and having it recompute when a clip is made.
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionStackedTimeline.tsx16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 970947b12..0985e5b2e 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -61,9 +61,10 @@ export type CollectionStackedTimelineProps = {
endTag: string;
mediaPath: string;
dictationKey: string;
+ rawDuration: number;
trimming: boolean;
- trimStart: number;
- trimEnd: number;
+ trimStart: () => number;
+ trimEnd: () => number;
trimDuration: number;
setStartTrim: (newStart: number) => void;
setEndTrim: (newEnd: number) => void;
@@ -94,11 +95,11 @@ export class CollectionStackedTimeline extends CollectionSubView<
}
get trimStart() {
- return this.props.trimStart;
+ return this.props.trimStart();
}
get trimEnd() {
- return this.props.trimEnd;
+ return this.props.trimEnd();
}
get duration() {
@@ -540,6 +541,7 @@ export class CollectionStackedTimeline extends CollectionSubView<
return !this.props.mediaPath ? null : (
<div className="collectionStackedTimeline-waveform">
<AudioWaveform
+ rawDuration={this.props.rawDuration}
duration={this.duration}
mediaPath={this.props.mediaPath}
layoutDoc={this.layoutDoc}
@@ -584,11 +586,7 @@ export class CollectionStackedTimeline extends CollectionSubView<
: Math.max((start - this.trimStart) / this.props.trimDuration * timelineContentWidth, 0);
const top = (d.level / maxLevel) * this.timelineContentHeight() + 15;
const timespan = end - start;
- let width = (timespan / this.props.trimDuration) * timelineContentWidth;
- width = (!this.props.trimming && left == 0) ?
- width - ((this.trimStart - start) / this.props.trimDuration * timelineContentWidth) : width;
- width = (!this.props.trimming && this.trimEnd < end) ?
- width - ((end - this.trimEnd) / this.props.trimDuration * timelineContentWidth) : width;
+ const width = (timespan / this.duration) * timelineContentWidth;
const height = (this.timelineContentHeight()) / maxLevel;
return this.props.Document.hideAnchors ? null : (
<div