@remotion/studio 4.0.472 → 4.0.474
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/api/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +45 -4
- package/dist/components/AssetSelectorItem.js +177 -27
- package/dist/components/Canvas.js +131 -11
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +49 -5
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +5 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/components/NewComposition/InputDragger.js +9 -6
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +29 -3
- package/dist/components/SelectedOutlineOverlay.js +259 -80
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterHandle.js +2 -0
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/SequencePropsObserver.js +3 -3
- package/dist/components/Timeline/Timeline.js +3 -13
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +26 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +242 -25
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +23 -11
- package/dist/components/Timeline/TimelineEffectItem.js +8 -7
- package/dist/components/Timeline/TimelineEffectPropItem.js +69 -19
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
- package/dist/components/Timeline/TimelineKeyframeControls.js +13 -23
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -22
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
- package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.js +15 -7
- package/dist/components/Timeline/TimelineRotationField.js +17 -11
- package/dist/components/Timeline/TimelineScaleField.js +17 -13
- package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
- package/dist/components/Timeline/TimelineSelection.js +26 -1
- package/dist/components/Timeline/TimelineSequence.js +6 -6
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +297 -36
- package/dist/components/Timeline/TimelineSequencePropItem.js +113 -48
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +69 -70
- package/dist/components/Timeline/TimelineTranslateField.js +24 -19
- package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
- package/dist/components/Timeline/call-add-keyframe.js +6 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
- package/dist/components/Timeline/call-delete-keyframe.js +7 -7
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
- package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +10 -7
- package/dist/components/Timeline/delete-selected-timeline-item.js +37 -23
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
- package/dist/components/Timeline/get-node-keyframes.js +4 -4
- package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
- package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
- package/dist/components/Timeline/reset-selected-timeline-props.js +13 -12
- package/dist/components/Timeline/save-effect-prop.d.ts +16 -5
- package/dist/components/Timeline/save-effect-prop.js +37 -19
- package/dist/components/Timeline/save-prop-queue.d.ts +4 -3
- package/dist/components/Timeline/save-prop-queue.js +6 -3
- package/dist/components/Timeline/save-sequence-prop.d.ts +5 -10
- package/dist/components/Timeline/save-sequence-prop.js +35 -32
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
- package/dist/components/Timeline/timeline-field-utils.js +26 -5
- package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
- package/dist/components/Timeline/timeline-translate-utils.js +6 -4
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
- package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
- package/dist/components/Timeline/use-timeline-height.js +3 -3
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +380 -0
- package/dist/components/import-assets.d.ts +31 -0
- package/dist/components/import-assets.js +216 -17
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-48grt472.js → chunk-xjvc8qen.js} +21838 -18862
- package/dist/esm/internals.mjs +21838 -18862
- package/dist/esm/previewEntry.mjs +21127 -18127
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.d.ts +6 -6
- package/dist/helpers/timeline-layout.js +5 -5
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +16 -2
- package/package.json +10 -10
- package/dist/helpers/detect-file-type.d.ts +0 -69
- package/dist/helpers/detect-file-type.js +0 -278
|
@@ -6,6 +6,7 @@ const studio_shared_1 = require("@remotion/studio-shared");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
9
|
+
const modals_1 = require("../../state/modals");
|
|
9
10
|
const ContextMenu_1 = require("../ContextMenu");
|
|
10
11
|
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
11
12
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
@@ -36,7 +37,7 @@ const isResettableStatus = ({ status, defaultValue, }) => {
|
|
|
36
37
|
const effectiveCodeValue = (_a = status.codeValue) !== null && _a !== void 0 ? _a : defaultValue;
|
|
37
38
|
return JSON.stringify(effectiveCodeValue) !== JSON.stringify(defaultValue);
|
|
38
39
|
};
|
|
39
|
-
const Value = ({ field, nodePath, validatedLocation, schema,
|
|
40
|
+
const Value = ({ field, nodePath, validatedLocation, schema, propStatus }) => {
|
|
40
41
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
41
42
|
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
42
43
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
@@ -46,17 +47,18 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
46
47
|
: ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
47
48
|
}, [getDragOverrides, nodePath, field.key]);
|
|
48
49
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
49
|
-
|
|
50
|
+
propStatus,
|
|
50
51
|
dragOverrideValue,
|
|
51
52
|
defaultValue: field.fieldSchema.default,
|
|
52
53
|
shouldResortToDefaultValueIfUndefined: true,
|
|
53
54
|
});
|
|
54
|
-
const {
|
|
55
|
+
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
55
56
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
56
57
|
const clientId = previewServerState.type === 'connected'
|
|
57
58
|
? previewServerState.clientId
|
|
58
59
|
: null;
|
|
59
60
|
const onSave = (0, react_1.useCallback)((value) => {
|
|
61
|
+
var _a;
|
|
60
62
|
if (!clientId) {
|
|
61
63
|
return Promise.reject(new Error('Not connected to studio server'));
|
|
62
64
|
}
|
|
@@ -64,31 +66,39 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
64
66
|
? JSON.stringify(field.fieldSchema.default)
|
|
65
67
|
: null;
|
|
66
68
|
const stringifiedValue = JSON.stringify(value);
|
|
67
|
-
|
|
69
|
+
const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
|
|
70
|
+
if (value === propStatus.codeValue) {
|
|
68
71
|
return Promise.resolve();
|
|
69
72
|
}
|
|
70
73
|
if (defaultValue === stringifiedValue &&
|
|
71
|
-
|
|
74
|
+
propStatus.codeValue === undefined) {
|
|
72
75
|
return Promise.resolve();
|
|
73
76
|
}
|
|
74
|
-
return (0, save_sequence_prop_1.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
return (0, save_sequence_prop_1.saveSequenceProps)({
|
|
78
|
+
changes: [
|
|
79
|
+
{
|
|
80
|
+
fileName: validatedLocation.source,
|
|
81
|
+
nodePath,
|
|
82
|
+
fieldKey: field.key,
|
|
83
|
+
value,
|
|
84
|
+
defaultValue,
|
|
85
|
+
schema,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
setPropStatuses,
|
|
82
89
|
clientId,
|
|
90
|
+
undoLabel: `Update ${fieldLabel}`,
|
|
91
|
+
redoLabel: `Update ${fieldLabel} again`,
|
|
83
92
|
});
|
|
84
93
|
}, [
|
|
85
|
-
|
|
94
|
+
propStatus,
|
|
86
95
|
clientId,
|
|
96
|
+
field.description,
|
|
87
97
|
field.fieldSchema.default,
|
|
88
98
|
field.key,
|
|
89
99
|
nodePath,
|
|
90
100
|
schema,
|
|
91
|
-
|
|
101
|
+
setPropStatuses,
|
|
92
102
|
validatedLocation,
|
|
93
103
|
]);
|
|
94
104
|
const onDragValueChange = (0, react_1.useCallback)((value) => {
|
|
@@ -103,35 +113,36 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
103
113
|
}
|
|
104
114
|
clearDragOverrides(nodePath);
|
|
105
115
|
}, [clearDragOverrides, nodePath]);
|
|
106
|
-
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus:
|
|
116
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue, scaleLockNodePath: nodePath }));
|
|
107
117
|
};
|
|
108
118
|
const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema, keyframeDisplayOffset, }) => {
|
|
109
119
|
var _a, _b;
|
|
110
|
-
const {
|
|
120
|
+
const { propStatuses: visualModePropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
111
121
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
112
|
-
const {
|
|
122
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
113
123
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
124
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
114
125
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
115
126
|
const clientId = previewServerState.type === 'connected'
|
|
116
127
|
? previewServerState.clientId
|
|
117
128
|
: null;
|
|
118
|
-
const
|
|
119
|
-
const
|
|
129
|
+
const propStatusesForOverride = remotion_1.Internals.getPropStatusesCtx(visualModePropStatuses, nodePath);
|
|
130
|
+
const propStatus = (_a = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
120
131
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
121
132
|
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
122
133
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
123
134
|
var _a;
|
|
124
135
|
return ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
125
136
|
}, [getDragOverrides, nodePath, field.key]);
|
|
126
|
-
const keyframeControls =
|
|
137
|
+
const keyframeControls = propStatus !== null &&
|
|
127
138
|
(0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
|
|
128
|
-
propStatus
|
|
139
|
+
propStatus,
|
|
129
140
|
selected: selection.selected,
|
|
130
141
|
keyframable: (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
131
142
|
schema,
|
|
132
143
|
key: field.key,
|
|
133
144
|
}),
|
|
134
|
-
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus:
|
|
145
|
+
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: propStatus, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: schema, effectIndex: null })) : null;
|
|
135
146
|
const style = (0, react_1.useMemo)(() => {
|
|
136
147
|
return {
|
|
137
148
|
...fieldRowBase,
|
|
@@ -139,49 +150,58 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
139
150
|
};
|
|
140
151
|
}, [field.rowHeight]);
|
|
141
152
|
const canResetToDefault = (0, react_1.useMemo)(() => {
|
|
142
|
-
if (!
|
|
153
|
+
if (!propStatus || propStatus.status === 'computed') {
|
|
143
154
|
return false;
|
|
144
155
|
}
|
|
145
156
|
return isResettableStatus({
|
|
146
|
-
status:
|
|
157
|
+
status: propStatus,
|
|
147
158
|
defaultValue: field.fieldSchema.default,
|
|
148
159
|
});
|
|
149
|
-
}, [
|
|
160
|
+
}, [propStatus, field.fieldSchema.default]);
|
|
150
161
|
const canPerformReset = previewServerState.type === 'connected' &&
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
propStatus !== null &&
|
|
163
|
+
propStatus.status !== 'computed';
|
|
153
164
|
const canShowReset = canPerformReset && field.fieldSchema.default !== undefined;
|
|
154
165
|
const onReset = (0, react_1.useCallback)(() => {
|
|
166
|
+
var _a;
|
|
155
167
|
if (!canShowReset ||
|
|
156
168
|
!canResetToDefault ||
|
|
157
169
|
previewServerState.type !== 'connected' ||
|
|
158
|
-
|
|
170
|
+
propStatus === null) {
|
|
159
171
|
return;
|
|
160
172
|
}
|
|
161
173
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
162
174
|
? JSON.stringify(field.fieldSchema.default)
|
|
163
175
|
: null;
|
|
164
|
-
(0
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
176
|
+
const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
|
|
177
|
+
(0, save_sequence_prop_1.saveSequenceProps)({
|
|
178
|
+
changes: [
|
|
179
|
+
{
|
|
180
|
+
fileName: validatedLocation.source,
|
|
181
|
+
nodePath,
|
|
182
|
+
fieldKey: field.key,
|
|
183
|
+
value: field.fieldSchema.default,
|
|
184
|
+
defaultValue,
|
|
185
|
+
schema,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
setPropStatuses,
|
|
172
189
|
clientId: previewServerState.clientId,
|
|
190
|
+
undoLabel: `Reset ${fieldLabel}`,
|
|
191
|
+
redoLabel: `Reapply ${fieldLabel}`,
|
|
173
192
|
});
|
|
174
193
|
}, [
|
|
175
194
|
canResetToDefault,
|
|
176
195
|
canShowReset,
|
|
196
|
+
field.description,
|
|
177
197
|
field.fieldSchema.default,
|
|
178
198
|
field.key,
|
|
179
199
|
nodePath,
|
|
180
200
|
previewServerState,
|
|
181
201
|
schema,
|
|
182
|
-
|
|
202
|
+
setPropStatuses,
|
|
183
203
|
validatedLocation.source,
|
|
184
|
-
|
|
204
|
+
propStatus,
|
|
185
205
|
]);
|
|
186
206
|
const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
|
|
187
207
|
if (!clientId) {
|
|
@@ -194,7 +214,7 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
194
214
|
sourceFrame,
|
|
195
215
|
value,
|
|
196
216
|
schema,
|
|
197
|
-
|
|
217
|
+
setPropStatuses,
|
|
198
218
|
clientId,
|
|
199
219
|
});
|
|
200
220
|
}, [
|
|
@@ -202,24 +222,48 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
202
222
|
field.key,
|
|
203
223
|
nodePath,
|
|
204
224
|
schema,
|
|
205
|
-
|
|
225
|
+
setPropStatuses,
|
|
206
226
|
validatedLocation.source,
|
|
207
227
|
]);
|
|
208
228
|
const onKeyframedDragValueChange = (0, react_1.useCallback)((value) => {
|
|
209
|
-
if (
|
|
229
|
+
if (propStatus === null || !isKeyframedStatus(propStatus)) {
|
|
210
230
|
throw new Error('Expected keyframed status');
|
|
211
231
|
}
|
|
212
232
|
setDragOverrides(nodePath, field.key, remotion_1.Internals.makeKeyframedDragOverride({
|
|
213
|
-
status:
|
|
233
|
+
status: propStatus,
|
|
214
234
|
frame: jsxFrame,
|
|
215
235
|
value,
|
|
216
236
|
}));
|
|
217
|
-
}, [
|
|
237
|
+
}, [propStatus, field.key, jsxFrame, nodePath, setDragOverrides]);
|
|
218
238
|
const onKeyframedDragEnd = (0, react_1.useCallback)(() => {
|
|
219
239
|
clearDragOverrides(nodePath);
|
|
220
240
|
}, [clearDragOverrides, nodePath]);
|
|
241
|
+
const onOpenKeyframeSettings = (0, react_1.useCallback)(() => {
|
|
242
|
+
var _a;
|
|
243
|
+
if (propStatus === null || !isKeyframedStatus(propStatus)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
setSelectedModal({
|
|
247
|
+
type: 'keyframe-settings',
|
|
248
|
+
fileName: validatedLocation.source,
|
|
249
|
+
nodePath,
|
|
250
|
+
fieldKey: field.key,
|
|
251
|
+
fieldLabel: (_a = field.description) !== null && _a !== void 0 ? _a : field.key,
|
|
252
|
+
status: propStatus,
|
|
253
|
+
schema,
|
|
254
|
+
effectIndex: null,
|
|
255
|
+
});
|
|
256
|
+
}, [
|
|
257
|
+
propStatus,
|
|
258
|
+
field.description,
|
|
259
|
+
field.key,
|
|
260
|
+
nodePath,
|
|
261
|
+
schema,
|
|
262
|
+
setSelectedModal,
|
|
263
|
+
validatedLocation.source,
|
|
264
|
+
]);
|
|
221
265
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
222
|
-
|
|
266
|
+
const values = [
|
|
223
267
|
{
|
|
224
268
|
type: 'item',
|
|
225
269
|
id: 'reset-sequence-field',
|
|
@@ -233,12 +277,33 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
233
277
|
value: 'reset-sequence-field',
|
|
234
278
|
},
|
|
235
279
|
];
|
|
236
|
-
|
|
237
|
-
|
|
280
|
+
if (propStatus !== null && isKeyframedStatus(propStatus)) {
|
|
281
|
+
values.push({
|
|
282
|
+
type: 'item',
|
|
283
|
+
id: 'keyframe-settings-sequence-field',
|
|
284
|
+
keyHint: null,
|
|
285
|
+
label: 'Keyframe settings...',
|
|
286
|
+
leftItem: null,
|
|
287
|
+
disabled: previewServerState.type !== 'connected',
|
|
288
|
+
onClick: onOpenKeyframeSettings,
|
|
289
|
+
quickSwitcherLabel: null,
|
|
290
|
+
subMenu: null,
|
|
291
|
+
value: 'keyframe-settings-sequence-field',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return values;
|
|
295
|
+
}, [
|
|
296
|
+
canShowReset,
|
|
297
|
+
propStatus,
|
|
298
|
+
onOpenKeyframeSettings,
|
|
299
|
+
onReset,
|
|
300
|
+
previewServerState,
|
|
301
|
+
]);
|
|
302
|
+
if (propStatus === null) {
|
|
238
303
|
return null;
|
|
239
304
|
}
|
|
240
305
|
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: [
|
|
241
|
-
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), isKeyframedStatus(
|
|
306
|
+
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), isKeyframedStatus(propStatus) ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: propStatus, keyframeDisplayOffset: keyframeDisplayOffset, dragOverrideValue: dragOverrideValue, onSave: onSaveKeyframed, onDragValueChange: onKeyframedDragValueChange, onDragEnd: onKeyframedDragEnd, scaleLockNodePath: nodePath }) })) : propStatus.status === 'static' ? (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, propStatus: propStatus }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: propStatus }) }))] }));
|
|
242
307
|
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: row }));
|
|
243
308
|
};
|
|
244
309
|
exports.TimelineSequencePropItem = TimelineSequencePropItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OverrideIdToNodePaths, PropStatuses, SequencePropsSubscriptionKey, TSequence } from 'remotion';
|
|
3
3
|
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
4
4
|
import { type SaveSequencePropChange } from './save-sequence-prop';
|
|
5
5
|
import { type TimelineSelection } from './TimelineSelection';
|
|
@@ -29,19 +29,19 @@ export declare const getTimelineSequenceFromDragChanges: ({ targets, deltaFrames
|
|
|
29
29
|
readonly targets: readonly TimelineSequenceFromDragTarget[];
|
|
30
30
|
readonly deltaFrames: number;
|
|
31
31
|
}) => SaveSequencePropChange[];
|
|
32
|
-
export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths,
|
|
32
|
+
export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }: {
|
|
33
33
|
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
34
34
|
readonly selectedItems: readonly TimelineSelection[];
|
|
35
35
|
readonly sequences: TSequence[];
|
|
36
36
|
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
37
|
-
readonly
|
|
37
|
+
readonly propStatuses: PropStatuses;
|
|
38
38
|
}) => TimelineSequenceDurationDragTarget[] | null;
|
|
39
|
-
export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths,
|
|
39
|
+
export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }: {
|
|
40
40
|
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
41
41
|
readonly selectedItems: readonly TimelineSelection[];
|
|
42
42
|
readonly sequences: TSequence[];
|
|
43
43
|
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
44
|
-
readonly
|
|
44
|
+
readonly propStatuses: PropStatuses;
|
|
45
45
|
}) => TimelineSequenceFromDragTarget[] | null;
|
|
46
46
|
export declare const useTimelineSequenceFromDrag: ({ nodePathInfo, windowWidth, timelineDurationInFrames, }: {
|
|
47
47
|
readonly nodePathInfo: SequenceNodePathInfo | null;
|
|
@@ -22,14 +22,14 @@ const baseStyle = {
|
|
|
22
22
|
zIndex: 1,
|
|
23
23
|
touchAction: 'none',
|
|
24
24
|
};
|
|
25
|
-
const canUpdateDurationInFrames = ({
|
|
25
|
+
const canUpdateDurationInFrames = ({ propStatuses, nodePath, }) => {
|
|
26
26
|
var _a, _b;
|
|
27
|
-
const status = (_b = (_a = remotion_1.Internals.
|
|
27
|
+
const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.durationInFrames) === null || _b === void 0 ? void 0 : _b.status;
|
|
28
28
|
return status === 'static';
|
|
29
29
|
};
|
|
30
|
-
const canUpdateFrom = ({
|
|
30
|
+
const canUpdateFrom = ({ propStatuses, nodePath, }) => {
|
|
31
31
|
var _a, _b;
|
|
32
|
-
const status = (_b = (_a = remotion_1.Internals.
|
|
32
|
+
const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.from) === null || _b === void 0 ? void 0 : _b.status;
|
|
33
33
|
return status === 'static';
|
|
34
34
|
};
|
|
35
35
|
const isDurationDraggableSequence = (sequence) => {
|
|
@@ -100,7 +100,7 @@ const findSequenceTrack = ({ tracks, nodePathInfo, }) => {
|
|
|
100
100
|
return ((0, studio_shared_1.stringifySequenceSubscriptionKey)(candidate.nodePathInfo.sequenceSubscriptionKey) === key && candidate.nodePathInfo.index === nodePathInfo.index);
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
-
const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths,
|
|
103
|
+
const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
|
|
104
104
|
const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
|
|
105
105
|
const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
|
|
106
106
|
const draggedItemIsSelected = selectedSequenceItems.some((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo) ===
|
|
@@ -116,18 +116,23 @@ const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedI
|
|
|
116
116
|
const targets = new Map();
|
|
117
117
|
for (const nodePathInfo of targetNodePathInfos) {
|
|
118
118
|
const track = findSequenceTrack({ tracks, nodePathInfo });
|
|
119
|
-
|
|
119
|
+
const originalSequence = track
|
|
120
|
+
? sequences.find((sequence) => sequence.id === track.sequence.id)
|
|
121
|
+
: null;
|
|
122
|
+
if (!track ||
|
|
123
|
+
!originalSequence ||
|
|
124
|
+
!isDurationDraggableSequence(originalSequence)) {
|
|
120
125
|
return null;
|
|
121
126
|
}
|
|
122
127
|
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
123
|
-
if (!canUpdateDurationInFrames({
|
|
128
|
+
if (!canUpdateDurationInFrames({ propStatuses, nodePath })) {
|
|
124
129
|
return null;
|
|
125
130
|
}
|
|
126
131
|
const key = (0, studio_shared_1.stringifySequenceSubscriptionKey)(nodePath);
|
|
127
132
|
if (!targets.has(key)) {
|
|
128
133
|
targets.set(key, {
|
|
129
134
|
fileName: nodePath.absolutePath,
|
|
130
|
-
initialDuration:
|
|
135
|
+
initialDuration: originalSequence.duration,
|
|
131
136
|
nodePath,
|
|
132
137
|
});
|
|
133
138
|
}
|
|
@@ -135,7 +140,7 @@ const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedI
|
|
|
135
140
|
return [...targets.values()];
|
|
136
141
|
};
|
|
137
142
|
exports.getTimelineSequenceDurationDragTargets = getTimelineSequenceDurationDragTargets;
|
|
138
|
-
const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths,
|
|
143
|
+
const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
|
|
139
144
|
const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
|
|
140
145
|
const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
|
|
141
146
|
const draggedItemIsSelected = selectedSequenceItems.some((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo) ===
|
|
@@ -160,7 +165,7 @@ const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems
|
|
|
160
165
|
return null;
|
|
161
166
|
}
|
|
162
167
|
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
163
|
-
if (!canUpdateFrom({
|
|
168
|
+
if (!canUpdateFrom({ propStatuses, nodePath })) {
|
|
164
169
|
return null;
|
|
165
170
|
}
|
|
166
171
|
const key = (0, studio_shared_1.stringifySequenceSubscriptionKey)(nodePath);
|
|
@@ -186,35 +191,29 @@ const clearFromDragOverrides = ({ clearDragOverrides, targets, }) => {
|
|
|
186
191
|
}
|
|
187
192
|
};
|
|
188
193
|
const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurationInFrames, }) => {
|
|
189
|
-
const {
|
|
190
|
-
const
|
|
191
|
-
const
|
|
194
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
195
|
+
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
196
|
+
const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
|
|
192
197
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
193
198
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
194
|
-
const
|
|
199
|
+
const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
|
|
195
200
|
const [dragging, setDragging] = (0, react_1.useState)(false);
|
|
196
201
|
const dragStateRef = (0, react_1.useRef)(null);
|
|
197
202
|
const latestRef = (0, react_1.useRef)({
|
|
198
203
|
nodePathInfo,
|
|
199
|
-
|
|
204
|
+
setPropStatuses,
|
|
200
205
|
setDragOverrides,
|
|
201
206
|
clearDragOverrides,
|
|
202
207
|
previewServerState,
|
|
203
|
-
codeValues,
|
|
204
|
-
sequences,
|
|
205
208
|
overrideIdToNodePathMappings,
|
|
206
|
-
selectedItems,
|
|
207
209
|
});
|
|
208
210
|
latestRef.current = {
|
|
209
211
|
nodePathInfo,
|
|
210
|
-
|
|
212
|
+
setPropStatuses,
|
|
211
213
|
setDragOverrides,
|
|
212
214
|
clearDragOverrides,
|
|
213
215
|
previewServerState,
|
|
214
|
-
codeValues,
|
|
215
|
-
sequences,
|
|
216
216
|
overrideIdToNodePathMappings,
|
|
217
|
-
selectedItems,
|
|
218
217
|
};
|
|
219
218
|
const finishDrag = (0, react_1.useCallback)((commit) => {
|
|
220
219
|
const dragState = dragStateRef.current;
|
|
@@ -225,7 +224,7 @@ const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurati
|
|
|
225
224
|
if (!dragState) {
|
|
226
225
|
return;
|
|
227
226
|
}
|
|
228
|
-
const {
|
|
227
|
+
const { setPropStatuses: latestSetPropStatuses, clearDragOverrides: latestClear, previewServerState: latestServerState, } = latestRef.current;
|
|
229
228
|
const changes = (0, exports.getTimelineSequenceFromDragChanges)({
|
|
230
229
|
targets: dragState.targets,
|
|
231
230
|
deltaFrames: dragState.latestDeltaFrames,
|
|
@@ -239,19 +238,15 @@ const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurati
|
|
|
239
238
|
});
|
|
240
239
|
return;
|
|
241
240
|
}
|
|
242
|
-
const savePromise =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
clientId: latestServerState.clientId,
|
|
252
|
-
undoLabel: 'Move selected sequences',
|
|
253
|
-
redoLabel: 'Move selected sequences back',
|
|
254
|
-
});
|
|
241
|
+
const savePromise = (0, save_sequence_prop_1.saveSequenceProps)({
|
|
242
|
+
changes,
|
|
243
|
+
setPropStatuses: latestSetPropStatuses,
|
|
244
|
+
clientId: latestServerState.clientId,
|
|
245
|
+
undoLabel: changes.length > 1 ? 'Move selected sequences' : 'Move sequence',
|
|
246
|
+
redoLabel: changes.length > 1
|
|
247
|
+
? 'Move selected sequences back'
|
|
248
|
+
: 'Move sequence back',
|
|
249
|
+
});
|
|
255
250
|
savePromise
|
|
256
251
|
.catch((err) => {
|
|
257
252
|
remotion_1.Internals.Log.error({ logLevel: 'error', tag: null }, 'Could not save from', err);
|
|
@@ -273,16 +268,17 @@ const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurati
|
|
|
273
268
|
if (pxPerFrame <= 0) {
|
|
274
269
|
return;
|
|
275
270
|
}
|
|
276
|
-
const { nodePathInfo: latestNodePathInfo,
|
|
271
|
+
const { nodePathInfo: latestNodePathInfo, overrideIdToNodePathMappings: latestOverrideIdsToNodePaths, } = latestRef.current;
|
|
272
|
+
const { selectedItems: latestSelectedItems } = currentSelection.current;
|
|
277
273
|
if (latestNodePathInfo === null) {
|
|
278
274
|
return;
|
|
279
275
|
}
|
|
280
276
|
const targets = (0, exports.getTimelineSequenceFromDragTargets)({
|
|
281
277
|
draggedNodePathInfo: latestNodePathInfo,
|
|
282
278
|
selectedItems: latestSelectedItems,
|
|
283
|
-
sequences:
|
|
279
|
+
sequences: sequencesRef.current,
|
|
284
280
|
overrideIdsToNodePaths: latestOverrideIdsToNodePaths,
|
|
285
|
-
|
|
281
|
+
propStatuses: propStatusesRef.current,
|
|
286
282
|
});
|
|
287
283
|
if (targets === null || targets.length === 0) {
|
|
288
284
|
return;
|
|
@@ -298,7 +294,13 @@ const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurati
|
|
|
298
294
|
document.body.style.userSelect = 'none';
|
|
299
295
|
document.body.style.webkitUserSelect = 'none';
|
|
300
296
|
setDragging(true);
|
|
301
|
-
}, [
|
|
297
|
+
}, [
|
|
298
|
+
currentSelection,
|
|
299
|
+
propStatusesRef,
|
|
300
|
+
sequencesRef,
|
|
301
|
+
timelineDurationInFrames,
|
|
302
|
+
windowWidth,
|
|
303
|
+
]);
|
|
302
304
|
(0, react_1.useEffect)(() => {
|
|
303
305
|
if (!dragging) {
|
|
304
306
|
return;
|
|
@@ -353,36 +355,30 @@ const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurati
|
|
|
353
355
|
};
|
|
354
356
|
exports.useTimelineSequenceFromDrag = useTimelineSequenceFromDrag;
|
|
355
357
|
const TimelineSequenceRightEdgeDragHandle = ({ nodePathInfo, windowWidth, timelineDurationInFrames }) => {
|
|
356
|
-
const {
|
|
357
|
-
const
|
|
358
|
-
const
|
|
358
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
359
|
+
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
360
|
+
const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
|
|
359
361
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
360
362
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
361
|
-
const
|
|
363
|
+
const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
|
|
362
364
|
const [dragging, setDragging] = (0, react_1.useState)(false);
|
|
363
365
|
const dragStateRef = (0, react_1.useRef)(null);
|
|
364
366
|
// Keep latest props/setters available to window listeners installed once at pointerdown.
|
|
365
367
|
const latestRef = (0, react_1.useRef)({
|
|
366
368
|
nodePathInfo,
|
|
367
|
-
|
|
369
|
+
setPropStatuses,
|
|
368
370
|
setDragOverrides,
|
|
369
371
|
clearDragOverrides,
|
|
370
372
|
previewServerState,
|
|
371
|
-
codeValues,
|
|
372
|
-
sequences,
|
|
373
373
|
overrideIdToNodePathMappings,
|
|
374
|
-
selectedItems,
|
|
375
374
|
});
|
|
376
375
|
latestRef.current = {
|
|
377
376
|
nodePathInfo,
|
|
378
|
-
|
|
377
|
+
setPropStatuses,
|
|
379
378
|
setDragOverrides,
|
|
380
379
|
clearDragOverrides,
|
|
381
380
|
previewServerState,
|
|
382
|
-
codeValues,
|
|
383
|
-
sequences,
|
|
384
381
|
overrideIdToNodePathMappings,
|
|
385
|
-
selectedItems,
|
|
386
382
|
};
|
|
387
383
|
const finishDrag = (0, react_1.useCallback)((commit) => {
|
|
388
384
|
const dragState = dragStateRef.current;
|
|
@@ -394,7 +390,7 @@ const TimelineSequenceRightEdgeDragHandle = ({ nodePathInfo, windowWidth, timeli
|
|
|
394
390
|
if (!dragState) {
|
|
395
391
|
return;
|
|
396
392
|
}
|
|
397
|
-
const {
|
|
393
|
+
const { setPropStatuses: latestSetPropStatuses, clearDragOverrides: latestClear, previewServerState: latestServerState, } = latestRef.current;
|
|
398
394
|
const changes = (0, exports.getTimelineSequenceDurationDragChanges)({
|
|
399
395
|
targets: dragState.targets,
|
|
400
396
|
deltaFrames: dragState.latestDeltaFrames,
|
|
@@ -408,19 +404,15 @@ const TimelineSequenceRightEdgeDragHandle = ({ nodePathInfo, windowWidth, timeli
|
|
|
408
404
|
});
|
|
409
405
|
return;
|
|
410
406
|
}
|
|
411
|
-
const savePromise =
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
clientId: latestServerState.clientId,
|
|
421
|
-
undoLabel: 'Resize selected sequences',
|
|
422
|
-
redoLabel: 'Resize selected sequences back',
|
|
423
|
-
});
|
|
407
|
+
const savePromise = (0, save_sequence_prop_1.saveSequenceProps)({
|
|
408
|
+
changes,
|
|
409
|
+
setPropStatuses: latestSetPropStatuses,
|
|
410
|
+
clientId: latestServerState.clientId,
|
|
411
|
+
undoLabel: changes.length > 1 ? 'Resize selected sequences' : 'Resize sequence',
|
|
412
|
+
redoLabel: changes.length > 1
|
|
413
|
+
? 'Resize selected sequences back'
|
|
414
|
+
: 'Resize sequence back',
|
|
415
|
+
});
|
|
424
416
|
savePromise
|
|
425
417
|
.catch((err) => {
|
|
426
418
|
remotion_1.Internals.Log.error({ logLevel: 'error', tag: null }, 'Could not save durationInFrames', err);
|
|
@@ -442,13 +434,14 @@ const TimelineSequenceRightEdgeDragHandle = ({ nodePathInfo, windowWidth, timeli
|
|
|
442
434
|
if (pxPerFrame <= 0) {
|
|
443
435
|
return;
|
|
444
436
|
}
|
|
445
|
-
const { nodePathInfo: latestNodePathInfo,
|
|
437
|
+
const { nodePathInfo: latestNodePathInfo, overrideIdToNodePathMappings: latestOverrideIdsToNodePaths, } = latestRef.current;
|
|
438
|
+
const { selectedItems: latestSelectedItems } = currentSelection.current;
|
|
446
439
|
const targets = (0, exports.getTimelineSequenceDurationDragTargets)({
|
|
447
440
|
draggedNodePathInfo: latestNodePathInfo,
|
|
448
441
|
selectedItems: latestSelectedItems,
|
|
449
|
-
sequences:
|
|
442
|
+
sequences: sequencesRef.current,
|
|
450
443
|
overrideIdsToNodePaths: latestOverrideIdsToNodePaths,
|
|
451
|
-
|
|
444
|
+
propStatuses: propStatusesRef.current,
|
|
452
445
|
});
|
|
453
446
|
if (targets === null || targets.length === 0) {
|
|
454
447
|
return;
|
|
@@ -466,7 +459,13 @@ const TimelineSequenceRightEdgeDragHandle = ({ nodePathInfo, windowWidth, timeli
|
|
|
466
459
|
document.body.style.webkitUserSelect = 'none';
|
|
467
460
|
(0, ForceSpecificCursor_1.forceSpecificCursor)('ew-resize');
|
|
468
461
|
setDragging(true);
|
|
469
|
-
}, [
|
|
462
|
+
}, [
|
|
463
|
+
currentSelection,
|
|
464
|
+
propStatusesRef,
|
|
465
|
+
sequencesRef,
|
|
466
|
+
timelineDurationInFrames,
|
|
467
|
+
windowWidth,
|
|
468
|
+
]);
|
|
470
469
|
// Install global pointer listeners while dragging. They survive parent re-renders
|
|
471
470
|
// and element remounts that would otherwise drop React's synthetic handlers or
|
|
472
471
|
// pointer capture.
|