@remotion/studio 4.0.468 → 4.0.470
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Studio.js +1 -1
- package/dist/api/save-render-output.js +3 -12
- package/dist/components/AudioWaveform.d.ts +1 -0
- package/dist/components/AudioWaveform.js +41 -23
- package/dist/components/CompositionSelectorItem.js +1 -1
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +8 -3
- package/dist/components/EditorContent.js +5 -4
- package/dist/components/EditorGuides/Guide.js +1 -1
- package/dist/components/ExpandedTracksProvider.js +3 -8
- package/dist/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +2 -2
- package/dist/components/Menu/MenuSubItem.js +5 -5
- package/dist/components/MenuBuildIndicator.js +0 -1
- package/dist/components/NewComposition/InputDragger.js +1 -0
- package/dist/components/Preview.js +4 -1
- package/dist/components/PreviewToolbar.js +2 -4
- package/dist/components/SelectedOutlineOverlay.d.ts +18 -0
- package/dist/components/SelectedOutlineOverlay.js +645 -0
- package/dist/components/Timeline/Timeline.js +18 -3
- package/dist/components/Timeline/TimelineDeleteKeybindings.d.ts +2 -0
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +86 -0
- package/dist/components/Timeline/TimelineDragHandler.js +19 -244
- package/dist/components/Timeline/{TimelineEffectGroupRow.d.ts → TimelineEffectItem.d.ts} +1 -1
- package/dist/components/Timeline/{TimelineEffectGroupRow.js → TimelineEffectItem.js} +61 -35
- package/dist/components/Timeline/{TimelineEffectFieldRow.d.ts → TimelineEffectPropItem.d.ts} +4 -1
- package/dist/components/Timeline/{TimelineEffectFieldRow.js → TimelineEffectPropItem.js} +100 -16
- package/dist/components/Timeline/TimelineExpandArrowButton.js +5 -1
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +11 -0
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +55 -0
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedRow.js +29 -11
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedSection.js +4 -4
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +1 -1
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +9 -120
- package/dist/components/Timeline/TimelineFieldLabel.d.ts +6 -0
- package/dist/components/Timeline/TimelineFieldLabel.js +30 -0
- package/dist/components/Timeline/TimelineInOutDragHandler.d.ts +2 -0
- package/dist/components/Timeline/TimelineInOutDragHandler.js +324 -0
- package/dist/components/Timeline/TimelineInOutPointer.js +3 -1
- package/dist/components/Timeline/TimelineInOutPointerHandle.d.ts +1 -0
- package/dist/components/Timeline/TimelineInOutPointerHandle.js +5 -4
- package/dist/components/Timeline/TimelineItemStack.d.ts +5 -0
- package/dist/components/Timeline/TimelineItemStack.js +82 -0
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeControls.js +217 -0
- package/dist/components/Timeline/TimelineKeyframeDiamond.d.ts +7 -0
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +88 -0
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +8 -0
- package/dist/components/Timeline/TimelineKeyframedValue.js +36 -0
- package/dist/components/Timeline/TimelineLayerEye.js +1 -0
- package/dist/components/Timeline/TimelineList.js +3 -11
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +13 -1
- package/dist/components/Timeline/TimelineMediaInfo.js +33 -80
- package/dist/components/Timeline/TimelineRowChrome.d.ts +10 -1
- package/dist/components/Timeline/TimelineRowChrome.js +64 -6
- package/dist/components/Timeline/TimelineSchemaField.js +7 -2
- package/dist/components/Timeline/TimelineSelection.d.ts +85 -0
- package/dist/components/Timeline/TimelineSelection.js +417 -0
- package/dist/components/Timeline/TimelineSequence.d.ts +2 -0
- package/dist/components/Timeline/TimelineSequence.js +18 -6
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/{TimelineListItem.d.ts → TimelineSequenceItem.d.ts} +2 -2
- package/dist/components/Timeline/{TimelineListItem.js → TimelineSequenceItem.js} +148 -63
- package/dist/components/Timeline/TimelineSequenceName.d.ts +7 -0
- package/dist/components/Timeline/TimelineSequenceName.js +50 -0
- package/dist/components/Timeline/{TimelineFieldRow.d.ts → TimelineSequencePropItem.d.ts} +5 -3
- package/dist/components/Timeline/TimelineSequencePropItem.js +183 -0
- package/dist/components/Timeline/TimelineTimeIndicators.js +0 -1
- package/dist/components/Timeline/TimelineTrack.d.ts +5 -0
- package/dist/components/Timeline/TimelineTrack.js +66 -0
- package/dist/components/Timeline/TimelineTracks.js +2 -16
- package/dist/components/Timeline/TimelineTranslateField.js +14 -22
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +11 -0
- package/dist/components/Timeline/TimelineUvCoordinateField.js +126 -0
- package/dist/components/Timeline/TimelineVideoInfo.js +11 -12
- package/dist/components/Timeline/call-add-keyframe.d.ts +23 -0
- package/dist/components/Timeline/call-add-keyframe.js +54 -0
- package/dist/components/Timeline/call-delete-keyframe.d.ts +21 -0
- package/dist/components/Timeline/call-delete-keyframe.js +50 -0
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +11 -0
- package/dist/components/Timeline/delete-selected-keyframe.js +51 -0
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +17 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +183 -0
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +13 -0
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +66 -0
- package/dist/components/Timeline/find-track-for-node-path-info.d.ts +7 -0
- package/dist/components/Timeline/find-track-for-node-path-info.js +13 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +9 -0
- package/dist/components/Timeline/get-keyframe-navigation.js +26 -0
- package/dist/components/Timeline/get-node-keyframes.d.ts +11 -0
- package/dist/components/Timeline/get-node-keyframes.js +23 -0
- package/dist/components/Timeline/get-timeline-keyframes.js +6 -8
- package/dist/components/Timeline/parse-keyframe-field-from-node-path.d.ts +8 -0
- package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +26 -0
- package/dist/components/Timeline/save-sequence-prop.d.ts +14 -2
- package/dist/components/Timeline/save-sequence-prop.js +42 -7
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +11 -1
- package/dist/components/Timeline/timeline-row-layout.d.ts +1 -0
- package/dist/components/Timeline/timeline-row-layout.js +2 -1
- package/dist/components/Timeline/timeline-translate-utils.d.ts +2 -0
- package/dist/components/Timeline/timeline-translate-utils.js +20 -0
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +17 -0
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +52 -0
- package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +6 -0
- package/dist/components/Timeline/use-open-sequence-in-editor.js +31 -0
- package/dist/components/composition-menu-items.js +32 -1
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +0 -1
- package/dist/esm/{chunk-8q828zk7.js → chunk-dny42qnq.js} +10566 -6221
- package/dist/esm/internals.mjs +10566 -6221
- package/dist/esm/previewEntry.mjs +10548 -6203
- package/dist/esm/renderEntry.mjs +3 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.js +1 -1
- package/dist/helpers/format-file-location.d.ts +9 -0
- package/dist/helpers/format-file-location.js +27 -0
- package/dist/helpers/get-box-quads-polyfill-internals.d.ts +82 -0
- package/dist/helpers/get-box-quads-polyfill-internals.js +2395 -0
- package/dist/helpers/get-box-quads-ponyfill.d.ts +10 -0
- package/dist/helpers/get-box-quads-ponyfill.js +23 -0
- package/dist/helpers/open-in-editor.d.ts +1 -1
- package/dist/helpers/open-in-editor.js +11 -26
- package/dist/helpers/timeline-layout.d.ts +8 -7
- package/dist/helpers/timeline-layout.js +9 -8
- package/dist/helpers/timeline-node-path-key.d.ts +2 -0
- package/dist/helpers/timeline-node-path-key.js +10 -0
- package/dist/helpers/use-menu-structure.js +8 -16
- package/dist/renderEntry.js +2 -2
- package/package.json +10 -10
- package/dist/components/Timeline/TimelineFieldRow.js +0 -113
- package/dist/components/Timeline/TimelineStack/index.d.ts +0 -8
- package/dist/components/Timeline/TimelineStack/index.js +0 -119
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineSequencePropItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
8
|
+
const ContextMenu_1 = require("../ContextMenu");
|
|
9
|
+
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
10
|
+
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
11
|
+
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
12
|
+
const TimelineFieldLabel_1 = require("./TimelineFieldLabel");
|
|
13
|
+
const TimelineKeyframeControls_1 = require("./TimelineKeyframeControls");
|
|
14
|
+
const TimelineKeyframedValue_1 = require("./TimelineKeyframedValue");
|
|
15
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
16
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
17
|
+
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
18
|
+
const TimelineSelection_1 = require("./TimelineSelection");
|
|
19
|
+
const fieldRowBase = {};
|
|
20
|
+
const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
21
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
22
|
+
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
23
|
+
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
return nodePath === null
|
|
26
|
+
? undefined
|
|
27
|
+
: ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
28
|
+
}, [getDragOverrides, nodePath, field.key]);
|
|
29
|
+
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
30
|
+
codeValue,
|
|
31
|
+
dragOverrideValue,
|
|
32
|
+
defaultValue: field.fieldSchema.default,
|
|
33
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
34
|
+
});
|
|
35
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
36
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
37
|
+
const clientId = previewServerState.type === 'connected'
|
|
38
|
+
? previewServerState.clientId
|
|
39
|
+
: null;
|
|
40
|
+
const onSave = (0, react_1.useCallback)((value) => {
|
|
41
|
+
if (!codeValue || !codeValue.canUpdate) {
|
|
42
|
+
return Promise.reject(new Error('Cannot save'));
|
|
43
|
+
}
|
|
44
|
+
if (!clientId) {
|
|
45
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
46
|
+
}
|
|
47
|
+
const defaultValue = field.fieldSchema.default !== undefined
|
|
48
|
+
? JSON.stringify(field.fieldSchema.default)
|
|
49
|
+
: null;
|
|
50
|
+
const stringifiedValue = JSON.stringify(value);
|
|
51
|
+
if (value === codeValue.codeValue) {
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
if (defaultValue === stringifiedValue &&
|
|
55
|
+
codeValue.codeValue === undefined) {
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
}
|
|
58
|
+
return (0, save_sequence_prop_1.saveSequenceProp)({
|
|
59
|
+
fileName: validatedLocation.source,
|
|
60
|
+
nodePath,
|
|
61
|
+
fieldKey: field.key,
|
|
62
|
+
value,
|
|
63
|
+
defaultValue,
|
|
64
|
+
schema,
|
|
65
|
+
setCodeValues,
|
|
66
|
+
clientId,
|
|
67
|
+
});
|
|
68
|
+
}, [
|
|
69
|
+
codeValue,
|
|
70
|
+
clientId,
|
|
71
|
+
field.fieldSchema.default,
|
|
72
|
+
field.key,
|
|
73
|
+
nodePath,
|
|
74
|
+
schema,
|
|
75
|
+
setCodeValues,
|
|
76
|
+
validatedLocation,
|
|
77
|
+
]);
|
|
78
|
+
const onDragValueChange = (0, react_1.useCallback)((value) => {
|
|
79
|
+
if (nodePath === null) {
|
|
80
|
+
throw new Error('Cannot drag value');
|
|
81
|
+
}
|
|
82
|
+
setDragOverrides(nodePath, field.key, value);
|
|
83
|
+
}, [setDragOverrides, nodePath, field.key]);
|
|
84
|
+
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
85
|
+
if (nodePath === null) {
|
|
86
|
+
throw new Error('Cannot clear drag value');
|
|
87
|
+
}
|
|
88
|
+
clearDragOverrides(nodePath);
|
|
89
|
+
}, [clearDragOverrides, nodePath]);
|
|
90
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
91
|
+
};
|
|
92
|
+
const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema, keyframeDisplayOffset, }) => {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
95
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
96
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
97
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
98
|
+
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
99
|
+
const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
|
|
100
|
+
const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
101
|
+
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
102
|
+
var _a;
|
|
103
|
+
return ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
104
|
+
}, [getDragOverrides, nodePath, field.key]);
|
|
105
|
+
const keyframeControls = codeValue !== null &&
|
|
106
|
+
(0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
|
|
107
|
+
propStatus: codeValue,
|
|
108
|
+
selected: selection.selected,
|
|
109
|
+
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: codeValue, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: schema, effectIndex: null })) : null;
|
|
110
|
+
const style = (0, react_1.useMemo)(() => {
|
|
111
|
+
return {
|
|
112
|
+
...fieldRowBase,
|
|
113
|
+
height: field.rowHeight,
|
|
114
|
+
};
|
|
115
|
+
}, [field.rowHeight]);
|
|
116
|
+
const isNonDefault = (0, react_1.useMemo)(() => {
|
|
117
|
+
var _a;
|
|
118
|
+
if (!codeValue || !codeValue.canUpdate) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const effectiveCodeValue = (_a = codeValue.codeValue) !== null && _a !== void 0 ? _a : field.fieldSchema.default;
|
|
122
|
+
return (JSON.stringify(effectiveCodeValue) !==
|
|
123
|
+
JSON.stringify(field.fieldSchema.default));
|
|
124
|
+
}, [codeValue, field.fieldSchema.default]);
|
|
125
|
+
const canPerformReset = previewServerState.type === 'connected' &&
|
|
126
|
+
codeValue !== null &&
|
|
127
|
+
codeValue.canUpdate;
|
|
128
|
+
const onReset = (0, react_1.useCallback)(() => {
|
|
129
|
+
if (!canPerformReset ||
|
|
130
|
+
previewServerState.type !== 'connected' ||
|
|
131
|
+
codeValue === null ||
|
|
132
|
+
!isNonDefault) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const defaultValue = field.fieldSchema.default !== undefined
|
|
136
|
+
? JSON.stringify(field.fieldSchema.default)
|
|
137
|
+
: null;
|
|
138
|
+
(0, save_sequence_prop_1.saveSequenceProp)({
|
|
139
|
+
fileName: validatedLocation.source,
|
|
140
|
+
nodePath,
|
|
141
|
+
fieldKey: field.key,
|
|
142
|
+
value: field.fieldSchema.default,
|
|
143
|
+
defaultValue,
|
|
144
|
+
schema,
|
|
145
|
+
setCodeValues,
|
|
146
|
+
clientId: previewServerState.clientId,
|
|
147
|
+
});
|
|
148
|
+
}, [
|
|
149
|
+
canPerformReset,
|
|
150
|
+
field.fieldSchema.default,
|
|
151
|
+
field.key,
|
|
152
|
+
isNonDefault,
|
|
153
|
+
nodePath,
|
|
154
|
+
previewServerState,
|
|
155
|
+
schema,
|
|
156
|
+
setCodeValues,
|
|
157
|
+
validatedLocation.source,
|
|
158
|
+
codeValue,
|
|
159
|
+
]);
|
|
160
|
+
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
161
|
+
return [
|
|
162
|
+
{
|
|
163
|
+
type: 'item',
|
|
164
|
+
id: 'reset-sequence-field',
|
|
165
|
+
keyHint: null,
|
|
166
|
+
label: 'Reset',
|
|
167
|
+
leftItem: null,
|
|
168
|
+
disabled: !canPerformReset,
|
|
169
|
+
onClick: onReset,
|
|
170
|
+
quickSwitcherLabel: null,
|
|
171
|
+
subMenu: null,
|
|
172
|
+
value: 'reset-sequence-field',
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
}, [canPerformReset, onReset]);
|
|
176
|
+
if (codeValue === null) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
const row = (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), keyframeControls: keyframeControls, arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, selected: selection.selected, selectable: selection.selectable, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: false, outerHeight: null, children: [
|
|
180
|
+
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), codeValue.canUpdate ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : codeValue.reason === 'keyframed' ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: codeValue, keyframeDisplayOffset: keyframeDisplayOffset }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
|
|
181
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: row }));
|
|
182
|
+
};
|
|
183
|
+
exports.TimelineSequencePropItem = TimelineSequencePropItem;
|
|
@@ -14,7 +14,6 @@ const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
|
14
14
|
exports.TIMELINE_TIME_INDICATOR_HEIGHT = 39;
|
|
15
15
|
const container = {
|
|
16
16
|
height: exports.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
17
|
-
boxShadow: `0 0 4px ${colors_1.TIMELINE_BACKGROUND}`,
|
|
18
17
|
position: 'absolute',
|
|
19
18
|
backgroundColor: colors_1.TIMELINE_BACKGROUND,
|
|
20
19
|
top: 0,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TimelineTrack = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
40
|
+
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
41
|
+
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
42
|
+
const TimelineExpandedTrackKeyframes_1 = require("./TimelineExpandedTrackKeyframes");
|
|
43
|
+
const TimelineSelection_1 = require("./TimelineSelection");
|
|
44
|
+
const TimelineSequence_1 = require("./TimelineSequence");
|
|
45
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
46
|
+
const TimelineTrackUnmemoized = ({ track }) => {
|
|
47
|
+
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
48
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
49
|
+
const previewServerConnected = previewServerState.type === 'connected';
|
|
50
|
+
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
51
|
+
const { selected: rowSelected } = (0, TimelineSelection_1.useTimelineRowSelection)(track.nodePathInfo);
|
|
52
|
+
const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(track.nodePathInfo);
|
|
53
|
+
const layerStyle = (0, react_1.useMemo)(() => ({
|
|
54
|
+
height: (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type),
|
|
55
|
+
marginBottom: timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
|
|
56
|
+
position: 'relative',
|
|
57
|
+
}), [track.sequence.type]);
|
|
58
|
+
const showExpandedKeyframes = track.nodePathInfo !== null &&
|
|
59
|
+
previewServerConnected &&
|
|
60
|
+
getIsExpanded(track.nodePathInfo);
|
|
61
|
+
const showRowHighlight = track.nodePathInfo !== null && (rowSelected || containsSelection);
|
|
62
|
+
return (jsx_runtime_1.jsxs("div", { children: [
|
|
63
|
+
jsx_runtime_1.jsxs("div", { style: layerStyle, children: [showRowHighlight && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth) })) : null, jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence, nodePathInfo: track.nodePathInfo })
|
|
64
|
+
] }), showExpandedKeyframes && track.nodePathInfo ? (jsx_runtime_1.jsx(TimelineExpandedTrackKeyframes_1.TimelineExpandedTrackKeyframes, { sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset })) : null] }));
|
|
65
|
+
};
|
|
66
|
+
exports.TimelineTrack = react_1.default.memo(TimelineTrackUnmemoized);
|
|
@@ -36,25 +36,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.TimelineTracks = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
-
const client_id_1 = require("../../helpers/client-id");
|
|
40
39
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
41
|
-
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
42
40
|
const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
|
|
43
|
-
const TimelineExpandedTrackKeyframes_1 = require("./TimelineExpandedTrackKeyframes");
|
|
44
|
-
const TimelineSequence_1 = require("./TimelineSequence");
|
|
45
41
|
const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
|
|
42
|
+
const TimelineTrack_1 = require("./TimelineTrack");
|
|
46
43
|
const content = {
|
|
47
44
|
paddingLeft: timeline_layout_1.TIMELINE_PADDING,
|
|
48
45
|
paddingRight: timeline_layout_1.TIMELINE_PADDING,
|
|
49
|
-
paddingTop: 1,
|
|
50
46
|
};
|
|
51
47
|
const timelineContent = {
|
|
52
48
|
minHeight: '100%',
|
|
53
49
|
};
|
|
54
50
|
const TimelineTracksInner = ({ timeline, hasBeenCut }) => {
|
|
55
|
-
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
56
|
-
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
57
|
-
const previewServerConnected = previewServerState.type === 'connected';
|
|
58
51
|
const timelineStyle = (0, react_1.useMemo)(() => {
|
|
59
52
|
return {
|
|
60
53
|
...timelineContent,
|
|
@@ -63,13 +56,6 @@ const TimelineTracksInner = ({ timeline, hasBeenCut }) => {
|
|
|
63
56
|
}, []);
|
|
64
57
|
return (jsx_runtime_1.jsxs("div", { style: timelineStyle, children: [
|
|
65
58
|
jsx_runtime_1.jsxs("div", { style: content, children: [
|
|
66
|
-
jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
|
|
67
|
-
const isExpanded = track.nodePathInfo !== null && getIsExpanded(track.nodePathInfo);
|
|
68
|
-
return (jsx_runtime_1.jsxs("div", { children: [
|
|
69
|
-
jsx_runtime_1.jsx("div", { style: {
|
|
70
|
-
height: (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type),
|
|
71
|
-
marginBottom: timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
|
|
72
|
-
}, children: jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence }) }), isExpanded && track.nodePathInfo && previewServerConnected ? (jsx_runtime_1.jsx(TimelineExpandedTrackKeyframes_1.TimelineExpandedTrackKeyframes, { sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset })) : null] }, track.sequence.id));
|
|
73
|
-
})] }), hasBeenCut ? jsx_runtime_1.jsx(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
|
|
59
|
+
jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => (jsx_runtime_1.jsx(TimelineTrack_1.TimelineTrack, { track: track }, track.sequence.id)))] }), hasBeenCut ? jsx_runtime_1.jsx(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
|
|
74
60
|
};
|
|
75
61
|
exports.TimelineTracks = react_1.default.memo(TimelineTracksInner);
|
|
@@ -5,20 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
7
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
|
+
const timeline_translate_utils_1 = require("./timeline-translate-utils");
|
|
8
9
|
const leftDraggerStyle = {
|
|
9
10
|
paddingLeft: 0,
|
|
10
11
|
};
|
|
11
12
|
const rightDraggerStyle = {
|
|
12
13
|
paddingRight: 0,
|
|
13
14
|
};
|
|
14
|
-
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
15
|
-
const parseTranslate = (value) => {
|
|
16
|
-
const m = value.match(PIXEL_PATTERN);
|
|
17
|
-
if (!m) {
|
|
18
|
-
return [0, 0];
|
|
19
|
-
}
|
|
20
|
-
return [Number(m[1]), m[2] !== undefined ? Number(m[2]) : 0];
|
|
21
|
-
};
|
|
22
15
|
const containerStyle = {
|
|
23
16
|
display: 'flex',
|
|
24
17
|
gap: 4,
|
|
@@ -27,8 +20,7 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
27
20
|
var _a;
|
|
28
21
|
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
29
22
|
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
30
|
-
const [codeX, codeY] = (0, react_1.useMemo)(() => parseTranslate(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px')), [effectiveValue]);
|
|
31
|
-
const makeString = (0, react_1.useCallback)((x, y) => `${x}px ${y}px`, []);
|
|
23
|
+
const [codeX, codeY] = (0, react_1.useMemo)(() => (0, timeline_translate_utils_1.parseTranslate)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px')), [effectiveValue]);
|
|
32
24
|
const step = field.fieldSchema.type === 'translate' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
|
|
33
25
|
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
34
26
|
const formatter = (0, react_1.useCallback)((v) => {
|
|
@@ -41,11 +33,11 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
41
33
|
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
42
34
|
setDragX(newVal);
|
|
43
35
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
44
|
-
onDragValueChange(
|
|
45
|
-
}, [onDragValueChange, dragY, codeY
|
|
36
|
+
onDragValueChange((0, timeline_translate_utils_1.serializeTranslate)(newVal, currentY));
|
|
37
|
+
}, [onDragValueChange, dragY, codeY]);
|
|
46
38
|
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
47
39
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
48
|
-
const newStr =
|
|
40
|
+
const newStr = (0, timeline_translate_utils_1.serializeTranslate)(newVal, currentY);
|
|
49
41
|
if (propStatus.canUpdate && newStr !== propStatus.codeValue) {
|
|
50
42
|
onSave(newStr).finally(() => {
|
|
51
43
|
setDragX(null);
|
|
@@ -56,13 +48,13 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
56
48
|
setDragX(null);
|
|
57
49
|
onDragEnd();
|
|
58
50
|
}
|
|
59
|
-
}, [dragY, codeY,
|
|
51
|
+
}, [dragY, codeY, propStatus, onSave, onDragEnd]);
|
|
60
52
|
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
61
53
|
if (propStatus.canUpdate) {
|
|
62
54
|
const parsed = Number(newVal);
|
|
63
55
|
if (!Number.isNaN(parsed)) {
|
|
64
56
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
65
|
-
const newStr =
|
|
57
|
+
const newStr = (0, timeline_translate_utils_1.serializeTranslate)(parsed, currentY);
|
|
66
58
|
if (newStr !== propStatus.codeValue) {
|
|
67
59
|
setDragX(parsed);
|
|
68
60
|
onSave(newStr).finally(() => {
|
|
@@ -71,16 +63,16 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
}
|
|
74
|
-
}, [propStatus, dragY, codeY,
|
|
66
|
+
}, [propStatus, dragY, codeY, onSave]);
|
|
75
67
|
// --- Y callbacks ---
|
|
76
68
|
const onYChange = (0, react_1.useCallback)((newVal) => {
|
|
77
69
|
setDragY(newVal);
|
|
78
70
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
79
|
-
onDragValueChange(
|
|
80
|
-
}, [onDragValueChange, dragX, codeX
|
|
71
|
+
onDragValueChange((0, timeline_translate_utils_1.serializeTranslate)(currentX, newVal));
|
|
72
|
+
}, [onDragValueChange, dragX, codeX]);
|
|
81
73
|
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
82
74
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
83
|
-
const newStr =
|
|
75
|
+
const newStr = (0, timeline_translate_utils_1.serializeTranslate)(currentX, newVal);
|
|
84
76
|
if (propStatus.canUpdate && newStr !== propStatus.codeValue) {
|
|
85
77
|
onSave(newStr).finally(() => {
|
|
86
78
|
setDragY(null);
|
|
@@ -91,13 +83,13 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
91
83
|
setDragY(null);
|
|
92
84
|
onDragEnd();
|
|
93
85
|
}
|
|
94
|
-
}, [dragX, codeX,
|
|
86
|
+
}, [dragX, codeX, propStatus, onSave, onDragEnd]);
|
|
95
87
|
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
96
88
|
if (propStatus.canUpdate) {
|
|
97
89
|
const parsed = Number(newVal);
|
|
98
90
|
if (!Number.isNaN(parsed)) {
|
|
99
91
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
100
|
-
const newStr =
|
|
92
|
+
const newStr = (0, timeline_translate_utils_1.serializeTranslate)(currentX, parsed);
|
|
101
93
|
if (newStr !== propStatus.codeValue) {
|
|
102
94
|
setDragY(parsed);
|
|
103
95
|
onSave(newStr).finally(() => {
|
|
@@ -106,7 +98,7 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
100
|
}
|
|
109
|
-
}, [propStatus, onSave, dragX, codeX
|
|
101
|
+
}, [propStatus, onSave, dragX, codeX]);
|
|
110
102
|
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
111
103
|
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false }), jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false })
|
|
112
104
|
] }));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
|
+
export declare const TimelineUvCoordinateField: React.FC<{
|
|
5
|
+
readonly field: SchemaFieldInfo;
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
7
|
+
readonly effectiveValue: unknown;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineUvCoordinateField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
|
+
const leftDraggerStyle = {
|
|
9
|
+
paddingLeft: 0,
|
|
10
|
+
};
|
|
11
|
+
const rightDraggerStyle = {
|
|
12
|
+
paddingRight: 0,
|
|
13
|
+
};
|
|
14
|
+
const containerStyle = {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
gap: 4,
|
|
17
|
+
};
|
|
18
|
+
const parseUvCoordinate = (value) => {
|
|
19
|
+
if (Array.isArray(value) &&
|
|
20
|
+
value.length === 2 &&
|
|
21
|
+
value.every((item) => typeof item === 'number' && Number.isFinite(item))) {
|
|
22
|
+
return [value[0], value[1]];
|
|
23
|
+
}
|
|
24
|
+
return [0, 0];
|
|
25
|
+
};
|
|
26
|
+
const tuplesEqual = (left, right) => {
|
|
27
|
+
if (!Array.isArray(left) || left.length !== 2) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return left[0] === right[0] && left[1] === right[1];
|
|
31
|
+
};
|
|
32
|
+
const TimelineUvCoordinateField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
33
|
+
var _a, _b, _c;
|
|
34
|
+
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
35
|
+
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
36
|
+
const [codeX, codeY] = (0, react_1.useMemo)(() => parseUvCoordinate(effectiveValue), [effectiveValue]);
|
|
37
|
+
const step = field.fieldSchema.type === 'uv-coordinate'
|
|
38
|
+
? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 0.01)
|
|
39
|
+
: 0.01;
|
|
40
|
+
const min = field.fieldSchema.type === 'uv-coordinate'
|
|
41
|
+
? ((_b = field.fieldSchema.min) !== null && _b !== void 0 ? _b : -Infinity)
|
|
42
|
+
: -Infinity;
|
|
43
|
+
const max = field.fieldSchema.type === 'uv-coordinate'
|
|
44
|
+
? ((_c = field.fieldSchema.max) !== null && _c !== void 0 ? _c : Infinity)
|
|
45
|
+
: Infinity;
|
|
46
|
+
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
47
|
+
const formatter = (0, react_1.useCallback)((v) => {
|
|
48
|
+
const num = Number(v);
|
|
49
|
+
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
50
|
+
return digits === 0 ? String(num) : num.toFixed(digits);
|
|
51
|
+
}, [stepDecimals]);
|
|
52
|
+
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
53
|
+
setDragX(newVal);
|
|
54
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
55
|
+
onDragValueChange([newVal, currentY]);
|
|
56
|
+
}, [onDragValueChange, dragY, codeY]);
|
|
57
|
+
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
58
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
59
|
+
const newTuple = [newVal, currentY];
|
|
60
|
+
if (propStatus.canUpdate &&
|
|
61
|
+
!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
62
|
+
onSave(newTuple).finally(() => {
|
|
63
|
+
setDragX(null);
|
|
64
|
+
onDragEnd();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
setDragX(null);
|
|
69
|
+
onDragEnd();
|
|
70
|
+
}
|
|
71
|
+
}, [dragY, codeY, propStatus, onSave, onDragEnd]);
|
|
72
|
+
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
73
|
+
if (propStatus.canUpdate) {
|
|
74
|
+
const parsed = Number(newVal);
|
|
75
|
+
if (!Number.isNaN(parsed)) {
|
|
76
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
77
|
+
const newTuple = [parsed, currentY];
|
|
78
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
79
|
+
setDragX(parsed);
|
|
80
|
+
onSave(newTuple).finally(() => {
|
|
81
|
+
setDragX(null);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [propStatus, dragY, codeY, onSave]);
|
|
87
|
+
const onYChange = (0, react_1.useCallback)((newVal) => {
|
|
88
|
+
setDragY(newVal);
|
|
89
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
90
|
+
onDragValueChange([currentX, newVal]);
|
|
91
|
+
}, [onDragValueChange, dragX, codeX]);
|
|
92
|
+
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
93
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
94
|
+
const newTuple = [currentX, newVal];
|
|
95
|
+
if (propStatus.canUpdate &&
|
|
96
|
+
!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
97
|
+
onSave(newTuple).finally(() => {
|
|
98
|
+
setDragY(null);
|
|
99
|
+
onDragEnd();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
setDragY(null);
|
|
104
|
+
onDragEnd();
|
|
105
|
+
}
|
|
106
|
+
}, [dragX, codeX, propStatus, onSave, onDragEnd]);
|
|
107
|
+
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
108
|
+
if (propStatus.canUpdate) {
|
|
109
|
+
const parsed = Number(newVal);
|
|
110
|
+
if (!Number.isNaN(parsed)) {
|
|
111
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
112
|
+
const newTuple = [currentX, parsed];
|
|
113
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
114
|
+
setDragY(parsed);
|
|
115
|
+
onSave(newTuple).finally(() => {
|
|
116
|
+
setDragY(null);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, [propStatus, onSave, dragX, codeX]);
|
|
122
|
+
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
123
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false }), jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false })
|
|
124
|
+
] }));
|
|
125
|
+
};
|
|
126
|
+
exports.TimelineUvCoordinateField = TimelineUvCoordinateField;
|
|
@@ -8,7 +8,6 @@ const remotion_1 = require("remotion");
|
|
|
8
8
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
9
9
|
const AudioWaveform_1 = require("../AudioWaveform");
|
|
10
10
|
const get_timeline_video_info_widths_1 = require("./get-timeline-video-info-widths");
|
|
11
|
-
const FILMSTRIP_HEIGHT = 48;
|
|
12
11
|
const outerStyle = {
|
|
13
12
|
width: '100%',
|
|
14
13
|
height: '100%',
|
|
@@ -16,7 +15,7 @@ const outerStyle = {
|
|
|
16
15
|
flexDirection: 'column',
|
|
17
16
|
};
|
|
18
17
|
const filmstripContainerStyle = {
|
|
19
|
-
height:
|
|
18
|
+
height: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
20
19
|
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
21
20
|
display: 'flex',
|
|
22
21
|
borderTopLeftRadius: 2,
|
|
@@ -48,7 +47,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
48
47
|
const controller = new AbortController();
|
|
49
48
|
const canvas = document.createElement('canvas');
|
|
50
49
|
canvas.width = mediaVisualizationWidth;
|
|
51
|
-
canvas.height =
|
|
50
|
+
canvas.height = timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT;
|
|
52
51
|
const ctx = canvas.getContext('2d');
|
|
53
52
|
if (!ctx) {
|
|
54
53
|
return;
|
|
@@ -103,7 +102,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
103
102
|
fromSeconds,
|
|
104
103
|
toSeconds,
|
|
105
104
|
aspectRatio: aspectRatio.current,
|
|
106
|
-
frameHeight:
|
|
105
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
107
106
|
});
|
|
108
107
|
(0, timeline_utils_1.fillWithCachedFrames)({
|
|
109
108
|
ctx: targetCtx,
|
|
@@ -113,7 +112,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
113
112
|
segmentDuration: toSeconds - fromSeconds,
|
|
114
113
|
fromSeconds,
|
|
115
114
|
devicePixelRatio: window.devicePixelRatio,
|
|
116
|
-
frameHeight:
|
|
115
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
117
116
|
});
|
|
118
117
|
repeatTarget();
|
|
119
118
|
const unfilled = Array.from(filledSlots.keys()).filter((timestamp) => !filledSlots.get(timestamp));
|
|
@@ -134,7 +133,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
134
133
|
toSeconds,
|
|
135
134
|
naturalWidth: targetWidth,
|
|
136
135
|
aspectRatio: aspectRatio.current,
|
|
137
|
-
frameHeight:
|
|
136
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
138
137
|
});
|
|
139
138
|
return Array.from(filledSlots.keys()).map((timestamp) => timestamp / timeline_utils_1.WEBCODECS_TIMESCALE);
|
|
140
139
|
},
|
|
@@ -143,7 +142,8 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
143
142
|
let frame;
|
|
144
143
|
try {
|
|
145
144
|
frame = sample.toVideoFrame();
|
|
146
|
-
const scale = (
|
|
145
|
+
const scale = (timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT / frame.displayHeight) *
|
|
146
|
+
window.devicePixelRatio;
|
|
147
147
|
const transformed = (0, timeline_utils_1.resizeVideoFrame)({
|
|
148
148
|
frame,
|
|
149
149
|
scale,
|
|
@@ -163,7 +163,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
163
163
|
toSeconds,
|
|
164
164
|
naturalWidth: targetWidth,
|
|
165
165
|
aspectRatio: aspectRatio.current,
|
|
166
|
-
frameHeight:
|
|
166
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
167
167
|
});
|
|
168
168
|
(0, timeline_utils_1.fillFrameWhereItFits)({
|
|
169
169
|
ctx: targetCtx,
|
|
@@ -173,7 +173,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
173
173
|
segmentDuration: toSeconds - fromSeconds,
|
|
174
174
|
fromSeconds,
|
|
175
175
|
devicePixelRatio: window.devicePixelRatio,
|
|
176
|
-
frameHeight:
|
|
176
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
177
177
|
});
|
|
178
178
|
repeatTarget();
|
|
179
179
|
}
|
|
@@ -201,7 +201,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
201
201
|
segmentDuration: toSeconds - fromSeconds,
|
|
202
202
|
fromSeconds,
|
|
203
203
|
devicePixelRatio: window.devicePixelRatio,
|
|
204
|
-
frameHeight:
|
|
204
|
+
frameHeight: timeline_layout_1.TIMELINE_LAYER_FILMSTRIP_HEIGHT,
|
|
205
205
|
});
|
|
206
206
|
repeatTarget();
|
|
207
207
|
})
|
|
@@ -233,14 +233,13 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
|
|
|
233
233
|
}, [mediaVisualizationWidth, premountWidth]);
|
|
234
234
|
const audioStyle = (0, react_1.useMemo)(() => {
|
|
235
235
|
return {
|
|
236
|
-
height: timeline_layout_1.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT,
|
|
237
236
|
width: audioWidth,
|
|
238
237
|
position: 'relative',
|
|
239
238
|
marginLeft: premountWidth,
|
|
240
239
|
};
|
|
241
240
|
}, [audioWidth, premountWidth]);
|
|
242
241
|
return (jsx_runtime_1.jsxs("div", { style: outerStyle, children: [
|
|
243
|
-
jsx_runtime_1.jsx("div", { ref: ref, style: filmstripStyle }), jsx_runtime_1.jsx("div", { style: audioStyle, children: jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: src, visualizationWidth: audioWidth, startFrom: trimBefore, durationInFrames: durationInFrames, volume: volume, doesVolumeChange: doesVolumeChange, playbackRate: playbackRate, loopDisplay: loopDisplay }) })
|
|
242
|
+
jsx_runtime_1.jsx("div", { ref: ref, style: filmstripStyle }), jsx_runtime_1.jsx("div", { style: audioStyle, children: jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: src, height: timeline_layout_1.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT, visualizationWidth: audioWidth, startFrom: trimBefore, durationInFrames: durationInFrames, volume: volume, doesVolumeChange: doesVolumeChange, playbackRate: playbackRate, loopDisplay: loopDisplay }) })
|
|
244
243
|
] }));
|
|
245
244
|
};
|
|
246
245
|
exports.TimelineVideoInfo = TimelineVideoInfo;
|