aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackedTimeline.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionStackedTimeline.tsx')
-rw-r--r--src/client/views/collections/CollectionStackedTimeline.tsx78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index cbf232d3d..e1e2990a0 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -98,34 +98,6 @@ export class CollectionStackedTimeline extends CollectionSubView<
@computed get currentTime() { return NumCast(this.layoutDoc._currentTimecode); }
- public get IsTrimming() { return this._trimming; }
-
- @action
- public StartTrimming(scope: TrimScope) {
- this._trimStart = this.clipStart;
- this._trimEnd = this.clipEnd;
- this._trimming = scope;
- }
- @action
- public StopTrimming() {
- this.layoutDoc.clipStart = this.trimStart;
- this.layoutDoc.clipEnd = this.trimEnd;
- this._trimming = TrimScope.None;
- }
-
- @computed get selectionContainer() {
- const markerEnd = CollectionStackedTimeline.SelectingRegion === this ? this.currentTime : this._markerEnd;
- return markerEnd === undefined ? null : (
- <div
- className="collectionStackedTimeline-selector"
- style={{
- left: `${((Math.min(this._markerStart, markerEnd) - this.trimStart) / this.trimDuration) * 100}%`,
- width: `${(Math.abs(this._markerStart - markerEnd) / this.trimDuration) * 100}%`,
- }}
- />
- );
- }
-
constructor(props: any) {
super(props);
// onClick play scripts
@@ -157,8 +129,23 @@ export class CollectionStackedTimeline extends CollectionSubView<
}
}
- 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], val));
+ public get IsTrimming() { return this._trimming; }
+
+ @action
+ public StartTrimming(scope: TrimScope) {
+ this._trimStart = this.clipStart;
+ this._trimEnd = this.clipEnd;
+ this._trimming = scope;
+ }
+ @action
+ public StopTrimming() {
+ this.layoutDoc.clipStart = this.trimStart;
+ this.layoutDoc.clipEnd = this.trimEnd;
+ this._trimming = TrimScope.None;
+ }
+
+ 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], val) ?? null);
toTimeline = (screen_delta: number, width: number) => {
return Math.max(
this.clipStart,
@@ -345,13 +332,13 @@ export class CollectionStackedTimeline extends CollectionSubView<
const localPt = this.props.ScreenToLocalTransform().transformPoint(de.x, de.y);
const x = localPt[0] - docDragData.offset[0];
const timelinePt = this.toTimeline(x, this.props.PanelWidth());
- for (let i = 0; i < docDragData.droppedDocuments.length; i++) {
- const d = Doc.GetProto(docDragData.droppedDocuments[i]);
+ docDragData.droppedDocuments.forEach(drop => {
+ const d = Doc.GetProto(drop);
if (this.anchorEnd(d) !== undefined) {
d[d._timecodeToHide === undefined ? this.props.endTag : "_timecodeToHide"] = timelinePt + this.anchorEnd(d) - this.anchorStart(d);
}
d[d._timecodToShow === undefined ? this.props.startTag : "_timecodToShow"] = timelinePt;
- }
+ });
return true;
}
@@ -483,9 +470,12 @@ export class CollectionStackedTimeline extends CollectionSubView<
}
dictationHeightPercent = 50;
- dictationHeight = () => (this.props.PanelHeight() * (100 - this.dictationHeightPercent)) / 100
- timelineContentHeight = () => (this.props.PanelHeight() * this.dictationHeightPercent) / 100
- dictationScreenToLocalTransform = () => this.props.ScreenToLocalTransform().translate(0, -this.timelineContentHeight())
+ dictationHeight = () => (this.props.PanelHeight() * (100 - this.dictationHeightPercent)) / 100;
+ timelineContentHeight = () => (this.props.PanelHeight() * this.dictationHeightPercent) / 100;
+ dictationScreenToLocalTransform = () => this.props.ScreenToLocalTransform().translate(0, -this.timelineContentHeight());
+ isContentActive = () => this.props.isSelected() || this.props.isContentActive();
+ currentTimecode = () => this.currentTime;
+
@computed get renderDictation() {
const dictation = Cast(this.dataDoc[this.props.dictationKey], Doc, null);
return !dictation ? null : (
@@ -537,9 +527,19 @@ export class CollectionStackedTimeline extends CollectionSubView<
</div>
);
}
+ @computed get selectionContainer() {
+ const markerEnd = CollectionStackedTimeline.SelectingRegion === this ? this.currentTime : this._markerEnd;
+ return markerEnd === undefined ? null : (
+ <div
+ className="collectionStackedTimeline-selector"
+ style={{
+ left: `${((Math.min(this._markerStart, markerEnd) - this.trimStart) / this.trimDuration) * 100}%`,
+ width: `${(Math.abs(this._markerStart - markerEnd) / this.trimDuration) * 100}%`,
+ }}
+ />
+ );
+ }
- isContentActive = () => this.props.isSelected() || this.props.isContentActive();
- currentTimecode = () => this.currentTime;
render() {
const timelineContentWidth = this.props.PanelWidth();
const overlaps: {
@@ -760,7 +760,7 @@ class StackedTimelineAnchor extends React.Component<StackedTimelineAnchorProps>
e,
(e) => {
if (!undo) undo = UndoManager.StartBatch("drag anchor");
- return changeAnchor(anchor, left, newTime(e))
+ return changeAnchor(anchor, left, newTime(e));
},
(e) => {
this.props.setTime(newTime(e));