@remotion/studio 4.0.507 → 4.0.509
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/FastRefreshProvider.js +13 -9
- package/dist/Studio.d.ts +5 -0
- package/dist/Studio.js +2 -2
- package/dist/components/Canvas.js +35 -5
- package/dist/components/CodingAgentIcon.d.ts +3 -1
- package/dist/components/CodingAgentIcon.js +4 -9
- package/dist/components/ColorPicker/AlphaSlider.js +2 -2
- package/dist/components/ColorPicker/HueSlider.js +2 -2
- package/dist/components/ColorPicker/SaturationValueArea.js +2 -2
- package/dist/components/ConfigureDefaultEditorModal.js +1 -1
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +32 -5
- package/dist/components/EditorContent.js +4 -3
- package/dist/components/EditorGuides/Guide.js +2 -2
- package/dist/components/EditorRuler/index.js +2 -2
- package/dist/components/ExplorerPanel.js +19 -1
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.js +1 -1
- package/dist/components/InspectorOpenInEditor.d.ts +1 -0
- package/dist/components/InspectorOpenInEditor.js +52 -8
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +3 -3
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/Menu/MenuItem.js +2 -2
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/ModalContainer.js +1 -1
- package/dist/components/Modals.js +2 -9
- package/dist/components/NewComposition/InputDragger.js +2 -2
- package/dist/components/NewComposition/NewComposition.d.ts +2 -0
- package/dist/components/NewComposition/NewComposition.js +38 -6
- package/dist/components/NewComposition/get-new-composition-defaults.d.ts +1 -1
- package/dist/components/NewComposition/get-new-composition-defaults.js +9 -1
- package/dist/components/PlayPause.d.ts +1 -1
- package/dist/components/PlayPause.js +61 -12
- package/dist/components/RenderButton.js +16 -12
- package/dist/components/RenderModal/GuiRenderStatus.js +23 -6
- package/dist/components/RenderModal/InfoBubble.d.ts +1 -0
- package/dist/components/RenderModal/InfoBubble.js +6 -4
- package/dist/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/components/RenderModal/InfoTooltip.js +12 -12
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +16 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -0
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +6 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +12 -1
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +9 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +239 -0
- package/dist/components/SelectedOutlineCropControls.js +2 -2
- package/dist/components/SelectedOutlineElement.d.ts +2 -1
- package/dist/components/SelectedOutlineElement.js +40 -5
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +55 -26
- package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
- package/dist/components/SelectedOutlinePolygon.js +6 -5
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -0
- package/dist/components/SelectedOutlineRenderer.js +24 -7
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +6 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +9 -7
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +2 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +11 -7
- package/dist/components/SelectedOutlineTransformOriginHandle.js +50 -24
- package/dist/components/SelectedOutlineUvControls.js +8 -8
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsModalFooter.js +1 -1
- package/dist/components/Splitter/SplitterHandle.js +2 -2
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Timeline/EasingEditorModal.js +2 -2
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/Timeline.js +55 -1
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +99 -35
- package/dist/components/Timeline/TimelineDragHandler.js +2 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineEffectPropItem.js +7 -0
- package/dist/components/Timeline/TimelineFieldRowContent.js +10 -3
- package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -2
- package/dist/components/Timeline/TimelineLayerEye.js +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +84 -12
- package/dist/components/Timeline/TimelineScaleField.js +58 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +4 -0
- package/dist/components/Timeline/TimelineSelection.js +47 -4
- package/dist/components/Timeline/TimelineSequenceItem.js +43 -25
- package/dist/components/Timeline/TimelineSequencePropItem.js +12 -3
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +6 -6
- package/dist/components/Timeline/TimelineTransformOriginField.js +78 -4
- package/dist/components/Timeline/TimelineTranslateField.js +55 -15
- package/dist/components/Timeline/Transform3DModeContext.d.ts +1 -0
- package/dist/components/Timeline/Transform3DModeContext.js +5 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +0 -6
- package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -6
- package/dist/components/Timeline/keyframe-clipboard.d.ts +5 -1
- package/dist/components/Timeline/keyframe-clipboard.js +3 -2
- package/dist/components/Timeline/save-sequence-prop.js +16 -7
- package/dist/components/Timeline/sequence-prop-clipboard.d.ts +31 -0
- package/dist/components/Timeline/sequence-prop-clipboard.js +142 -0
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +5 -2
- package/dist/components/Timeline/timeline-field-display-utils.js +2 -2
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +6 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +16 -1
- package/dist/components/Timeline/timeline-rotation-utils.d.ts +16 -0
- package/dist/components/Timeline/timeline-rotation-utils.js +145 -4
- package/dist/components/Timeline/timeline-translate-utils.d.ts +3 -2
- package/dist/components/Timeline/timeline-translate-utils.js +8 -4
- package/dist/components/Timeline/transform-3d-mode.d.ts +6 -0
- package/dist/components/Timeline/transform-3d-mode.js +36 -0
- package/dist/components/Timeline/transform-origin-utils.d.ts +4 -0
- package/dist/components/Timeline/transform-origin-utils.js +12 -6
- package/dist/components/Timeline/update-selected-easing.js +8 -0
- package/dist/components/Timeline/use-open-sequence-in-apps.js +3 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +5 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.js +67 -10
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -2
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +4 -4
- package/dist/components/call-api.js +2 -0
- package/dist/components/canvas-rotation-cursor.d.ts +1 -0
- package/dist/components/canvas-rotation-cursor.js +14 -0
- package/dist/components/folder-menu-items.js +1 -0
- package/dist/components/get-open-in-menu-items.d.ts +8 -1
- package/dist/components/get-open-in-menu-items.js +93 -8
- package/dist/components/import-assets.js +7 -0
- package/dist/components/root-composition-menu-items.js +1 -0
- package/dist/components/selected-outline-control-layout.d.ts +14 -0
- package/dist/components/selected-outline-control-layout.js +94 -0
- package/dist/components/selected-outline-drag.d.ts +11 -5
- package/dist/components/selected-outline-drag.js +80 -42
- package/dist/components/selected-outline-measurement.d.ts +5 -0
- package/dist/components/selected-outline-measurement.js +28 -1
- package/dist/components/selected-outline-types.d.ts +6 -0
- package/dist/components/use-default-editor-info.js +28 -3
- package/dist/esm/{chunk-ptnd65a9.js → chunk-jdn6nkbk.js} +10087 -7919
- package/dist/esm/{chunk-fgedsvhb.js → chunk-r46yxrjr.js} +1 -2
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +10086 -7918
- package/dist/esm/previewEntry.mjs +9926 -7758
- package/dist/esm/renderEntry.mjs +4 -2
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/get-canvas-capture-import.d.ts +7 -0
- package/dist/helpers/get-canvas-capture-import.js +43 -0
- package/dist/helpers/get-git-menu-item.d.ts +1 -1
- package/dist/helpers/get-git-menu-item.js +33 -3
- package/dist/helpers/inserted-element-selection.d.ts +12 -0
- package/dist/helpers/inserted-element-selection.js +29 -0
- package/dist/helpers/open-in-editor.d.ts +3 -1
- package/dist/helpers/open-in-editor.js +5 -1
- package/dist/helpers/pointer-session.d.ts +6 -2
- package/dist/helpers/pointer-session.js +29 -12
- package/dist/helpers/preview-server-events.js +4 -0
- package/dist/helpers/sequence-node-path-mutations.d.ts +4 -0
- package/dist/helpers/sequence-node-path-mutations.js +31 -0
- package/dist/helpers/use-create-composition.d.ts +15 -2
- package/dist/helpers/use-create-composition.js +11 -17
- package/dist/helpers/use-menu-structure.js +1 -0
- package/dist/icons/cube.d.ts +4 -0
- package/dist/icons/cube.js +6 -0
- package/dist/icons/finder.d.ts +4 -0
- package/dist/icons/finder.js +8 -0
- package/dist/icons/github.d.ts +4 -0
- package/dist/icons/github.js +11 -0
- package/dist/icons/terminal.d.ts +6 -0
- package/dist/icons/terminal.js +46 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/dist/renderEntry.js +2 -2
- package/dist/state/modals.d.ts +9 -1
- package/dist/state/transform-3d-mode.d.ts +10 -0
- package/dist/state/transform-3d-mode.js +27 -0
- package/dist/state/z-index.d.ts +0 -1
- package/dist/state/z-index.js +28 -37
- package/package.json +12 -12
|
@@ -3,10 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SequencePropsObserver = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const fast_refresh_context_1 = require("../../fast-refresh-context");
|
|
6
7
|
const client_id_1 = require("../../helpers/client-id");
|
|
8
|
+
const sequence_node_path_mutations_1 = require("../../helpers/sequence-node-path-mutations");
|
|
9
|
+
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
7
10
|
const SequencePropsObserver = () => {
|
|
8
11
|
const { subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
9
|
-
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
12
|
+
const { remapPropStatuses, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
13
|
+
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
14
|
+
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
15
|
+
const overrideIdToNodePathMappingsRef = (0, react_1.useRef)(overrideIdToNodePathMappings);
|
|
16
|
+
overrideIdToNodePathMappingsRef.current = overrideIdToNodePathMappings;
|
|
17
|
+
const { setOverrideIdToNodePath } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsSettersContext);
|
|
18
|
+
const { fastRefreshes } = (0, react_1.useContext)(fast_refresh_context_1.FastRefreshContext);
|
|
19
|
+
const { migrateExpandedTracksForSubscriptionKey } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
10
20
|
(0, react_1.useEffect)(() => {
|
|
11
21
|
const handleEvent = (event) => {
|
|
12
22
|
if (event.type !== 'sequence-props-updated') {
|
|
@@ -19,6 +29,92 @@ const SequencePropsObserver = () => {
|
|
|
19
29
|
unsubscribe();
|
|
20
30
|
};
|
|
21
31
|
}, [setPropStatuses, subscribeToEvent]);
|
|
32
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
const mutations = (0, sequence_node_path_mutations_1.takePendingSequenceNodePathMutations)();
|
|
35
|
+
if (mutations.length === 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const statusRemappings = [];
|
|
39
|
+
const overrideUpdates = [];
|
|
40
|
+
for (const [overrideId, previousNodePath] of Object.entries(overrideIdToNodePathMappingsRef.current)) {
|
|
41
|
+
let { nodePath } = previousNodePath;
|
|
42
|
+
let wasRemapped = false;
|
|
43
|
+
let wasDeleted = false;
|
|
44
|
+
let runtimeNodePathExists = true;
|
|
45
|
+
const previousNodePathString = JSON.stringify(previousNodePath.nodePath);
|
|
46
|
+
for (const mutation of mutations) {
|
|
47
|
+
for (const file of mutation.files) {
|
|
48
|
+
if (file.absolutePath !== previousNodePath.absolutePath) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
// Prop statuses follow source nodes to their new paths. Override IDs,
|
|
52
|
+
// however, follow React's runtime instances. After deleting an unkeyed
|
|
53
|
+
// sibling, React reuses the instance already at the destination path.
|
|
54
|
+
// Keep that mapping in place and only remove mappings for vacated paths.
|
|
55
|
+
const runtimeNodePathIsSource = file.remappings.some((item) => JSON.stringify(item.oldNodePath) === previousNodePathString);
|
|
56
|
+
const runtimeNodePathIsDestination = file.remappings.some((item) => item.newNodePath !== null &&
|
|
57
|
+
JSON.stringify(item.newNodePath) === previousNodePathString);
|
|
58
|
+
const runtimeNodePathWasRestored = file.restoredNodePaths.some((item) => JSON.stringify(item) === previousNodePathString);
|
|
59
|
+
if (runtimeNodePathIsSource) {
|
|
60
|
+
runtimeNodePathExists =
|
|
61
|
+
runtimeNodePathIsDestination || runtimeNodePathWasRestored;
|
|
62
|
+
}
|
|
63
|
+
else if (runtimeNodePathIsDestination ||
|
|
64
|
+
runtimeNodePathWasRestored) {
|
|
65
|
+
runtimeNodePathExists = true;
|
|
66
|
+
}
|
|
67
|
+
if (wasDeleted) {
|
|
68
|
+
const wasRestored = file.restoredNodePaths.some((restoredNodePath) => JSON.stringify(restoredNodePath) === JSON.stringify(nodePath));
|
|
69
|
+
if (wasRestored) {
|
|
70
|
+
wasDeleted = false;
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const remapping = file.remappings.find((item) => JSON.stringify(item.oldNodePath) === JSON.stringify(nodePath));
|
|
75
|
+
if (!remapping) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
wasRemapped = true;
|
|
79
|
+
if (remapping.newNodePath === null) {
|
|
80
|
+
wasDeleted = true;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
nodePath = remapping.newNodePath;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!wasRemapped) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const nextNodePath = wasDeleted ? null : { ...previousNodePath, nodePath };
|
|
90
|
+
const previousStatusKey = remotion_1.Internals.makeSequencePropsSubscriptionKey(previousNodePath);
|
|
91
|
+
statusRemappings.push({
|
|
92
|
+
previousNodePath,
|
|
93
|
+
nodePath: nextNodePath,
|
|
94
|
+
result: (_a = propStatusesRef.current[previousStatusKey]) !== null && _a !== void 0 ? _a : null,
|
|
95
|
+
});
|
|
96
|
+
overrideUpdates.push({
|
|
97
|
+
overrideId,
|
|
98
|
+
nodePath: runtimeNodePathExists ? previousNodePath : null,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
remapPropStatuses(statusRemappings);
|
|
102
|
+
for (const event of overrideUpdates) {
|
|
103
|
+
setOverrideIdToNodePath(event.overrideId, event.nodePath);
|
|
104
|
+
}
|
|
105
|
+
for (const event of statusRemappings) {
|
|
106
|
+
if (event.nodePath === null) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
migrateExpandedTracksForSubscriptionKey(event.previousNodePath, event.nodePath);
|
|
110
|
+
}
|
|
111
|
+
}, [
|
|
112
|
+
fastRefreshes,
|
|
113
|
+
migrateExpandedTracksForSubscriptionKey,
|
|
114
|
+
propStatusesRef,
|
|
115
|
+
remapPropStatuses,
|
|
116
|
+
setOverrideIdToNodePath,
|
|
117
|
+
]);
|
|
22
118
|
return null;
|
|
23
119
|
};
|
|
24
120
|
exports.SequencePropsObserver = SequencePropsObserver;
|
|
@@ -6,7 +6,7 @@ const no_react_1 = require("remotion/no-react");
|
|
|
6
6
|
const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
|
|
7
7
|
const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
|
|
8
8
|
const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack, effects }) => {
|
|
9
|
-
const
|
|
9
|
+
const { resolvedLocation, stack, preferMappedNodePath } = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(getStack, overrideId);
|
|
10
10
|
const effectSubscriptions = (0, react_1.useMemo)(() => {
|
|
11
11
|
return effects
|
|
12
12
|
.map((effect) => {
|
|
@@ -19,7 +19,9 @@ const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack,
|
|
|
19
19
|
componentIdentity,
|
|
20
20
|
schema,
|
|
21
21
|
effects: effectSubscriptions,
|
|
22
|
-
originalLocation,
|
|
22
|
+
originalLocation: resolvedLocation,
|
|
23
|
+
preferMappedNodePath,
|
|
24
|
+
stack,
|
|
23
25
|
});
|
|
24
26
|
return null;
|
|
25
27
|
};
|
|
@@ -37,10 +37,12 @@ exports.Timeline = void 0;
|
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const remotion_1 = require("remotion");
|
|
40
|
+
const fast_refresh_context_1 = require("../../fast-refresh-context");
|
|
40
41
|
const browser_studio_operations_1 = require("../../helpers/browser-studio-operations");
|
|
41
42
|
const calculate_timeline_1 = require("../../helpers/calculate-timeline");
|
|
42
43
|
const client_id_1 = require("../../helpers/client-id");
|
|
43
44
|
const colors_1 = require("../../helpers/colors");
|
|
45
|
+
const inserted_element_selection_1 = require("../../helpers/inserted-element-selection");
|
|
44
46
|
const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
|
|
45
47
|
const is_current_selected_still_1 = require("../../helpers/is-current-selected-still");
|
|
46
48
|
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
@@ -230,7 +232,7 @@ const TimelineContextMenuArea = ({ children }) => {
|
|
|
230
232
|
const TimelineInner = () => {
|
|
231
233
|
var _a;
|
|
232
234
|
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
233
|
-
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
235
|
+
const { canvasContent, compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
234
236
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
235
237
|
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
236
238
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
@@ -253,6 +255,58 @@ const TimelineInner = () => {
|
|
|
253
255
|
overrideIdToNodePathMappings,
|
|
254
256
|
compositions,
|
|
255
257
|
]);
|
|
258
|
+
const pendingInsertedElementSelection = (0, react_1.useSyncExternalStore)(inserted_element_selection_1.subscribeToInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection);
|
|
259
|
+
const { fastRefreshes } = (0, react_1.useContext)(fast_refresh_context_1.FastRefreshContext);
|
|
260
|
+
const pendingSelectionStart = (0, react_1.useRef)(null);
|
|
261
|
+
const { selectItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
262
|
+
(0, react_1.useEffect)(() => {
|
|
263
|
+
var _a;
|
|
264
|
+
if (pendingInsertedElementSelection === null) {
|
|
265
|
+
pendingSelectionStart.current = null;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const matchesInsertedNodePath = (track) => track.nodePathInfo !== null &&
|
|
269
|
+
track.nodePathInfo.sequenceSubscriptionKey.absolutePath ===
|
|
270
|
+
pendingInsertedElementSelection.nodePath.absolutePath &&
|
|
271
|
+
JSON.stringify(track.nodePathInfo.sequenceSubscriptionKey.nodePath) ===
|
|
272
|
+
JSON.stringify(pendingInsertedElementSelection.nodePath.nodePath);
|
|
273
|
+
if (((_a = pendingSelectionStart.current) === null || _a === void 0 ? void 0 : _a.selection) !==
|
|
274
|
+
pendingInsertedElementSelection) {
|
|
275
|
+
pendingSelectionStart.current = {
|
|
276
|
+
selection: pendingInsertedElementSelection,
|
|
277
|
+
fastRefreshes,
|
|
278
|
+
existingSequenceIds: new Set(timeline
|
|
279
|
+
.filter(matchesInsertedNodePath)
|
|
280
|
+
.map((track) => track.sequence.id)),
|
|
281
|
+
};
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (pendingSelectionStart.current.fastRefreshes === fastRefreshes) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' &&
|
|
288
|
+
canvasContent.compositionId !==
|
|
289
|
+
pendingInsertedElementSelection.compositionId) {
|
|
290
|
+
(0, inserted_element_selection_1.clearInsertedElementSelection)(pendingInsertedElementSelection);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const insertedTrack = timeline.find((track) => {
|
|
294
|
+
var _a;
|
|
295
|
+
return matchesInsertedNodePath(track) &&
|
|
296
|
+
!((_a = pendingSelectionStart.current) === null || _a === void 0 ? void 0 : _a.existingSequenceIds.has(track.sequence.id));
|
|
297
|
+
});
|
|
298
|
+
if (!insertedTrack || insertedTrack.nodePathInfo === null) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
selectItems([{ type: 'sequence', nodePathInfo: insertedTrack.nodePathInfo }], { reveal: true });
|
|
302
|
+
(0, inserted_element_selection_1.clearInsertedElementSelection)(pendingInsertedElementSelection);
|
|
303
|
+
}, [
|
|
304
|
+
canvasContent,
|
|
305
|
+
fastRefreshes,
|
|
306
|
+
pendingInsertedElementSelection,
|
|
307
|
+
selectItems,
|
|
308
|
+
timeline,
|
|
309
|
+
]);
|
|
256
310
|
const durationInFrames = (_a = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _a !== void 0 ? _a : 0;
|
|
257
311
|
const filtered = (0, react_1.useMemo)(() => {
|
|
258
312
|
return timeline.filter((t) => (0, should_show_track_in_timeline_1.shouldShowTrackInTimeline)(t, durationInFrames));
|
|
@@ -21,6 +21,8 @@ const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info
|
|
|
21
21
|
const imperative_state_1 = require("./imperative-state");
|
|
22
22
|
const keyframe_clipboard_1 = require("./keyframe-clipboard");
|
|
23
23
|
const save_effect_prop_1 = require("./save-effect-prop");
|
|
24
|
+
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
25
|
+
const sequence_prop_clipboard_1 = require("./sequence-prop-clipboard");
|
|
24
26
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
25
27
|
const update_selected_easing_1 = require("./update-selected-easing");
|
|
26
28
|
const makeClipboardText = (payload) => JSON.stringify(payload);
|
|
@@ -76,37 +78,6 @@ const getPasteEffectsTarget = (selectedItems) => {
|
|
|
76
78
|
};
|
|
77
79
|
};
|
|
78
80
|
exports.getPasteEffectsTarget = getPasteEffectsTarget;
|
|
79
|
-
const isClipboardInterpolationFunction = (value) => {
|
|
80
|
-
return (0, studio_shared_1.isKeyframeInterpolationFunction)(value);
|
|
81
|
-
};
|
|
82
|
-
const effectPropStatusToClipboardParam = (prop) => {
|
|
83
|
-
if (prop.status === 'computed') {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
if (prop.status === 'static') {
|
|
87
|
-
if (prop.codeValue === undefined) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
type: 'static',
|
|
92
|
-
value: prop.codeValue,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
if (!isClipboardInterpolationFunction(prop.interpolationFunction)) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
type: 'keyframed',
|
|
100
|
-
interpolationFunction: prop.interpolationFunction,
|
|
101
|
-
keyframes: prop.keyframes,
|
|
102
|
-
easing: prop.easing,
|
|
103
|
-
clamping: prop.clamping,
|
|
104
|
-
...(prop.output === undefined || prop.output === 'linear'
|
|
105
|
-
? {}
|
|
106
|
-
: { output: prop.output }),
|
|
107
|
-
...(prop.posterize === undefined ? {} : { posterize: prop.posterize }),
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
81
|
const effectStatusToSnapshot = (effect) => {
|
|
111
82
|
if (effect.importPath === null) {
|
|
112
83
|
return null;
|
|
@@ -116,7 +87,7 @@ const effectStatusToSnapshot = (effect) => {
|
|
|
116
87
|
if (prop.status === 'static' && prop.codeValue === undefined) {
|
|
117
88
|
continue;
|
|
118
89
|
}
|
|
119
|
-
const param =
|
|
90
|
+
const param = (0, sequence_prop_clipboard_1.propStatusToClipboardParam)(prop);
|
|
120
91
|
if (param === null) {
|
|
121
92
|
return null;
|
|
122
93
|
}
|
|
@@ -251,7 +222,7 @@ const getEffectPropClipboardDataFromSelection = ({ selection, propStatuses, }) =
|
|
|
251
222
|
if (!prop) {
|
|
252
223
|
return null;
|
|
253
224
|
}
|
|
254
|
-
const param =
|
|
225
|
+
const param = (0, sequence_prop_clipboard_1.propStatusToClipboardParam)(prop);
|
|
255
226
|
if (param === null) {
|
|
256
227
|
return null;
|
|
257
228
|
}
|
|
@@ -397,7 +368,7 @@ const TimelineClipboardKeybindings = () => {
|
|
|
397
368
|
event: 'keydown',
|
|
398
369
|
key: 'c',
|
|
399
370
|
callback: (e) => {
|
|
400
|
-
var _a;
|
|
371
|
+
var _a, _b;
|
|
401
372
|
const { selectedItems } = currentSelection.current;
|
|
402
373
|
const propStatuses = propStatusesRef.current;
|
|
403
374
|
const sequences = sequencesRef.current;
|
|
@@ -456,10 +427,37 @@ const TimelineClipboardKeybindings = () => {
|
|
|
456
427
|
});
|
|
457
428
|
return;
|
|
458
429
|
}
|
|
430
|
+
if (selectedItems.some((selection) => selection.type === 'sequence-prop')) {
|
|
431
|
+
e.preventDefault();
|
|
432
|
+
if (selectedItems.length !== 1 ||
|
|
433
|
+
((_a = selectedItems[0]) === null || _a === void 0 ? void 0 : _a.type) !== 'sequence-prop') {
|
|
434
|
+
(0, NotificationCenter_1.showNotification)('Select one property to copy its value', 3000);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const payload = (0, sequence_prop_clipboard_1.getSequencePropClipboardDataFromSelection)({
|
|
438
|
+
selection: selectedItems[0],
|
|
439
|
+
propStatuses,
|
|
440
|
+
sequences,
|
|
441
|
+
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
442
|
+
});
|
|
443
|
+
if (payload === null) {
|
|
444
|
+
(0, NotificationCenter_1.showNotification)('Cannot copy property because its value cannot be copied', 3000);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
navigator.clipboard
|
|
448
|
+
.writeText(makeClipboardText(payload))
|
|
449
|
+
.then(() => {
|
|
450
|
+
(0, NotificationCenter_1.showNotification)('Copied property value', 1000);
|
|
451
|
+
})
|
|
452
|
+
.catch((err) => {
|
|
453
|
+
(0, NotificationCenter_1.showNotification)(`Could not copy property: ${err.message}`, 2000);
|
|
454
|
+
});
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
459
457
|
if (selectedItems.some((selection) => selection.type === 'sequence-effect-prop')) {
|
|
460
458
|
e.preventDefault();
|
|
461
459
|
if (selectedItems.length !== 1 ||
|
|
462
|
-
((
|
|
460
|
+
((_b = selectedItems[0]) === null || _b === void 0 ? void 0 : _b.type) !== 'sequence-effect-prop') {
|
|
463
461
|
(0, NotificationCenter_1.showNotification)('Select one effect prop to copy its value', 3000);
|
|
464
462
|
return;
|
|
465
463
|
}
|
|
@@ -732,6 +730,72 @@ const TimelineClipboardKeybindings = () => {
|
|
|
732
730
|
(0, NotificationCenter_1.showNotification)(`Could not paste easing: ${err.message}`, 3000);
|
|
733
731
|
});
|
|
734
732
|
}
|
|
733
|
+
const sequencePropResult = (0, studio_shared_1.parseSequencePropClipboardDataResult)(text);
|
|
734
|
+
if (sequencePropResult.status !== 'invalid') {
|
|
735
|
+
e.preventDefault();
|
|
736
|
+
if (sequencePropResult.status === 'unsupported-version') {
|
|
737
|
+
(0, NotificationCenter_1.showNotification)('Cannot paste property copied from a different Remotion Studio version', 4000);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const sequencePropTarget = (0, sequence_prop_clipboard_1.getPasteSequencePropTarget)({
|
|
741
|
+
selectedItems,
|
|
742
|
+
payload: sequencePropResult.data,
|
|
743
|
+
propStatuses,
|
|
744
|
+
sequences,
|
|
745
|
+
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
746
|
+
});
|
|
747
|
+
if (sequencePropTarget.type !== 'valid') {
|
|
748
|
+
switch (sequencePropTarget.type) {
|
|
749
|
+
case 'none':
|
|
750
|
+
(0, NotificationCenter_1.showNotification)('Select a property or sequence to paste onto', 3000);
|
|
751
|
+
return;
|
|
752
|
+
case 'prop-mismatch':
|
|
753
|
+
(0, NotificationCenter_1.showNotification)('Select the same property to paste this value', 3000);
|
|
754
|
+
return;
|
|
755
|
+
case 'uncopyable':
|
|
756
|
+
(0, NotificationCenter_1.showNotification)('Cannot paste onto a property that cannot be updated', 3000);
|
|
757
|
+
return;
|
|
758
|
+
case 'incompatible':
|
|
759
|
+
(0, NotificationCenter_1.showNotification)('The copied value is not compatible with this property', 3000);
|
|
760
|
+
return;
|
|
761
|
+
default:
|
|
762
|
+
throw new Error(`Unexpected paste target: ${sequencePropTarget}`);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
const { param } = sequencePropResult.data;
|
|
766
|
+
return (0, save_sequence_prop_1.saveSequenceProps)({
|
|
767
|
+
changes: sequencePropTarget.targets.map((pasteTarget) => ({
|
|
768
|
+
fileName: pasteTarget.fileName,
|
|
769
|
+
nodePath: pasteTarget.nodePath,
|
|
770
|
+
fieldKey: pasteTarget.fieldKey,
|
|
771
|
+
value: param.type === 'static' ? param.value : undefined,
|
|
772
|
+
defaultValue: pasteTarget.defaultValue,
|
|
773
|
+
schema: pasteTarget.schema,
|
|
774
|
+
...(param.type === 'keyframed'
|
|
775
|
+
? {
|
|
776
|
+
sourceEdit: {
|
|
777
|
+
type: 'clipboard-param',
|
|
778
|
+
param,
|
|
779
|
+
},
|
|
780
|
+
}
|
|
781
|
+
: {}),
|
|
782
|
+
})),
|
|
783
|
+
addedKeyframes: null,
|
|
784
|
+
movedKeyframes: null,
|
|
785
|
+
setPropStatuses,
|
|
786
|
+
clientId,
|
|
787
|
+
undoLabel: sequencePropTarget.targets.length > 1
|
|
788
|
+
? 'Paste property onto selected sequences'
|
|
789
|
+
: 'Paste property',
|
|
790
|
+
redoLabel: sequencePropTarget.targets.length > 1
|
|
791
|
+
? 'Reapply property paste onto selected sequences'
|
|
792
|
+
: 'Reapply property paste',
|
|
793
|
+
}).then(() => {
|
|
794
|
+
(0, NotificationCenter_1.showNotification)(sequencePropTarget.targets.length > 1
|
|
795
|
+
? 'Pasted property onto selected sequences'
|
|
796
|
+
: 'Pasted property', 2000);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
735
799
|
const effectPropResult = (0, studio_shared_1.parseEffectPropClipboardDataResult)(text);
|
|
736
800
|
if (effectPropResult.status !== 'invalid') {
|
|
737
801
|
e.preventDefault();
|
|
@@ -274,9 +274,9 @@ const TimelineDragHandlerInner = () => {
|
|
|
274
274
|
if (!dragging.dragging) {
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
-
return (0, pointer_session_1.
|
|
277
|
+
return (0, pointer_session_1.startCapturedPointerSession)({
|
|
278
278
|
event: dragging,
|
|
279
|
-
|
|
279
|
+
captureTarget: dragging.target,
|
|
280
280
|
onMove: onPointerMoveScrubbing,
|
|
281
281
|
onEnd: (reason, endEvent) => {
|
|
282
282
|
if ((reason === 'pointerup' || reason === 'buttons-released') &&
|
|
@@ -109,10 +109,7 @@ const TimelineEffectItem = ({ label, nodePathInfo, effectIndex, effectSchema, do
|
|
|
109
109
|
effectIndex,
|
|
110
110
|
},
|
|
111
111
|
]);
|
|
112
|
-
if (result.success) {
|
|
113
|
-
(0, NotificationCenter_1.showNotification)('Removed effect from source file', 2000);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
112
|
+
if (!result.success) {
|
|
116
113
|
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
117
114
|
}
|
|
118
115
|
}
|
|
@@ -63,11 +63,18 @@ const TimelineEffectPropValue = ({ field, nodePath, validatedLocation, sourceFra
|
|
|
63
63
|
status: propStatus,
|
|
64
64
|
frame: sourceFrame,
|
|
65
65
|
value,
|
|
66
|
+
defaultEasing: (0, studio_shared_1.isSchemaFieldHoldOnly)({
|
|
67
|
+
schema: field.effectSchema,
|
|
68
|
+
key: field.key,
|
|
69
|
+
})
|
|
70
|
+
? { type: 'step1' }
|
|
71
|
+
: undefined,
|
|
66
72
|
})
|
|
67
73
|
: remotion_1.Internals.makeStaticDragOverride(value);
|
|
68
74
|
setEffectDragOverrides(nodePath, field.effectIndex, field.key, nextDragOverrideValue);
|
|
69
75
|
}, [
|
|
70
76
|
field.effectIndex,
|
|
77
|
+
field.effectSchema,
|
|
71
78
|
field.key,
|
|
72
79
|
nodePath,
|
|
73
80
|
propStatus,
|
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineFieldRowContent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
6
7
|
const TimelineFieldLabel_1 = require("./TimelineFieldLabel");
|
|
8
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
7
9
|
const TimelineFieldRowContent = ({ field, rowDepth, selected, children }) => {
|
|
8
10
|
var _a;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
12
|
+
const stacked = (0, timeline_field_row_layout_1.isTimelineFieldStacked)({ field, transform3DMode });
|
|
13
|
+
const compactStacked = stacked && field.typeName !== 'text-content';
|
|
14
|
+
const label = (jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selected, label: (_a = field.description) !== null && _a !== void 0 ? _a : field.key, stacked: stacked }));
|
|
15
|
+
const value = (jsx_runtime_1.jsx("div", { style: compactStacked
|
|
16
|
+
? timeline_field_row_layout_1.timelineCompactStackedFieldValueColumnStyle
|
|
17
|
+
: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: children }));
|
|
18
|
+
if (stacked) {
|
|
12
19
|
return (jsx_runtime_1.jsxs("div", { style: timeline_field_row_layout_1.timelineStackedFieldContentStyle, children: [label, value] }));
|
|
13
20
|
}
|
|
14
21
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [label, value] }));
|
|
@@ -275,9 +275,9 @@ const TimelineInOutDragHandlerInner = () => {
|
|
|
275
275
|
if (inOutDragging.dragging === false) {
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
return (0, pointer_session_1.
|
|
278
|
+
return (0, pointer_session_1.startCapturedPointerSession)({
|
|
279
279
|
event: inOutDragging,
|
|
280
|
-
|
|
280
|
+
captureTarget: inOutDragging.target,
|
|
281
281
|
onMove: onPointerMoveInOut,
|
|
282
282
|
onEnd: (reason, endEvent) => {
|
|
283
283
|
if ((reason === 'pointerup' || reason === 'buttons-released') &&
|
|
@@ -58,9 +58,9 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
|
|
|
58
58
|
layerPointedDown = hidden ? 'enable' : 'disable';
|
|
59
59
|
onInvoked(layerPointedDown);
|
|
60
60
|
lastPaintedLayerEye = e.currentTarget;
|
|
61
|
-
stopLayerPointerSession = (0, pointer_session_1.
|
|
61
|
+
stopLayerPointerSession = (0, pointer_session_1.startCapturedPointerSession)({
|
|
62
62
|
event: e,
|
|
63
|
-
|
|
63
|
+
captureTarget: e.currentTarget,
|
|
64
64
|
onMove: (moveEvent) => {
|
|
65
65
|
var _a, _b;
|
|
66
66
|
const pointedElement = (_a = document
|
|
@@ -7,16 +7,35 @@ const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
|
7
7
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
8
|
const timeline_rotation_field_utils_1 = require("./timeline-rotation-field-utils");
|
|
9
9
|
const timeline_rotation_utils_1 = require("./timeline-rotation-utils");
|
|
10
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
11
|
+
const containerStyle = {
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
display: 'flex',
|
|
14
|
+
gap: 4,
|
|
15
|
+
};
|
|
16
|
+
const compactDraggerStyle = {
|
|
17
|
+
paddingBottom: 2,
|
|
18
|
+
paddingLeft: 2,
|
|
19
|
+
paddingRight: 2,
|
|
20
|
+
paddingTop: 2,
|
|
21
|
+
};
|
|
22
|
+
const ROTATION_LABELS = ['X', 'Y', 'Z'];
|
|
10
23
|
const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
|
|
11
24
|
var _a, _b;
|
|
12
25
|
const [dragValue, setDragValue] = (0, react_1.useState)(null);
|
|
26
|
+
const [dragRotation, setDragRotation] = (0, react_1.useState)(null);
|
|
27
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
13
28
|
const isCssRotation = field.fieldSchema.type === 'rotation-css';
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
const cssRotation = (0, react_1.useMemo)(() => isCssRotation
|
|
30
|
+
? (0, timeline_rotation_utils_1.parseCssRotationToEuler)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg'))
|
|
31
|
+
: [0, 0, 0], [effectiveValue, isCssRotation]);
|
|
32
|
+
const show3D = isCssRotation &&
|
|
33
|
+
(transform3DMode || cssRotation[0] !== 0 || cssRotation[1] !== 0);
|
|
34
|
+
const degrees = isCssRotation
|
|
35
|
+
? cssRotation[2]
|
|
36
|
+
: typeof effectiveValue === 'number'
|
|
37
|
+
? effectiveValue
|
|
38
|
+
: 0;
|
|
20
39
|
const configuredStep = field.fieldSchema.type === 'rotation-css' ||
|
|
21
40
|
field.fieldSchema.type === 'rotation-degrees'
|
|
22
41
|
? field.fieldSchema.step
|
|
@@ -32,11 +51,13 @@ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDr
|
|
|
32
51
|
defaultDecimalPlaces: 1,
|
|
33
52
|
step: configuredStep,
|
|
34
53
|
}), [configuredStep]);
|
|
35
|
-
const serializeValue = (0, react_1.useCallback)((value) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
const serializeValue = (0, react_1.useCallback)((value) => isCssRotation
|
|
55
|
+
? (0, timeline_rotation_utils_1.serializeCssRotation)(value, decimalPlaces)
|
|
56
|
+
: (0, timeline_field_utils_1.normalizeTimelineNumber)(value), [decimalPlaces, isCssRotation]);
|
|
57
|
+
const serializeRotation = (0, react_1.useCallback)((rotation) => (0, timeline_rotation_utils_1.serializeCssRotationFromEuler)({
|
|
58
|
+
rotation,
|
|
59
|
+
decimalPlaces: Math.max(6, decimalPlaces),
|
|
60
|
+
}), [decimalPlaces]);
|
|
40
61
|
const onValueChange = (0, react_1.useCallback)((newVal) => {
|
|
41
62
|
setDragValue(newVal);
|
|
42
63
|
onDragValueChange(serializeValue(newVal));
|
|
@@ -73,6 +94,57 @@ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDr
|
|
|
73
94
|
value: v,
|
|
74
95
|
});
|
|
75
96
|
}, [decimalPlaces, field.fieldSchema]);
|
|
76
|
-
|
|
97
|
+
const onRotationValueChange = (0, react_1.useCallback)((rotationIndex, newValue) => {
|
|
98
|
+
const nextRotation = [...(dragRotation !== null && dragRotation !== void 0 ? dragRotation : cssRotation)];
|
|
99
|
+
nextRotation[rotationIndex] = newValue;
|
|
100
|
+
setDragRotation(nextRotation);
|
|
101
|
+
onDragValueChange(serializeRotation(nextRotation));
|
|
102
|
+
}, [cssRotation, dragRotation, onDragValueChange, serializeRotation]);
|
|
103
|
+
const onRotationValueChangeEnd = (0, react_1.useCallback)((rotationIndex, newValue) => {
|
|
104
|
+
const nextRotation = [...(dragRotation !== null && dragRotation !== void 0 ? dragRotation : cssRotation)];
|
|
105
|
+
nextRotation[rotationIndex] = newValue;
|
|
106
|
+
const newRotation = serializeRotation(nextRotation);
|
|
107
|
+
const clearDragState = () => {
|
|
108
|
+
setDragRotation(null);
|
|
109
|
+
onDragEnd();
|
|
110
|
+
};
|
|
111
|
+
if (newRotation !== propStatus.codeValue) {
|
|
112
|
+
onSave(newRotation).finally(clearDragState);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
clearDragState();
|
|
116
|
+
}
|
|
117
|
+
}, [
|
|
118
|
+
cssRotation,
|
|
119
|
+
dragRotation,
|
|
120
|
+
onDragEnd,
|
|
121
|
+
onSave,
|
|
122
|
+
propStatus.codeValue,
|
|
123
|
+
serializeRotation,
|
|
124
|
+
]);
|
|
125
|
+
const onRotationTextChange = (0, react_1.useCallback)((rotationIndex, newValue) => {
|
|
126
|
+
const parsed = Number(newValue);
|
|
127
|
+
if (Number.isNaN(parsed)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const nextRotation = [...(dragRotation !== null && dragRotation !== void 0 ? dragRotation : cssRotation)];
|
|
131
|
+
nextRotation[rotationIndex] = parsed;
|
|
132
|
+
const newRotation = serializeRotation(nextRotation);
|
|
133
|
+
if (newRotation !== propStatus.codeValue) {
|
|
134
|
+
setDragRotation(nextRotation);
|
|
135
|
+
onSave(newRotation).finally(() => setDragRotation(null));
|
|
136
|
+
}
|
|
137
|
+
}, [
|
|
138
|
+
cssRotation,
|
|
139
|
+
dragRotation,
|
|
140
|
+
onSave,
|
|
141
|
+
propStatus.codeValue,
|
|
142
|
+
serializeRotation,
|
|
143
|
+
]);
|
|
144
|
+
const angleDragger = (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragValue !== null && dragValue !== void 0 ? dragValue : degrees, style: timeline_field_utils_1.draggerStyle, status: "ok", small: true, onValueChange: onValueChange, onValueChangeEnd: onValueChangeEnd, onTextChange: onTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false, "aria-label": isCssRotation ? 'Rotation Z' : 'Rotation angle' }));
|
|
145
|
+
if (show3D) {
|
|
146
|
+
return (jsx_runtime_1.jsx("span", { style: containerStyle, children: ROTATION_LABELS.map((rotationLabel, rotationIndex) => (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: (dragRotation !== null && dragRotation !== void 0 ? dragRotation : cssRotation)[rotationIndex], buttonStyle: compactDraggerStyle, status: "ok", small: true, onValueChange: (newValue) => onRotationValueChange(rotationIndex, newValue), onValueChangeEnd: (newValue) => onRotationValueChangeEnd(rotationIndex, newValue), onTextChange: (newValue) => onRotationTextChange(rotationIndex, newValue), min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, "aria-label": `Rotation ${rotationLabel}` }, rotationLabel))) }));
|
|
147
|
+
}
|
|
148
|
+
return angleDragger;
|
|
77
149
|
};
|
|
78
150
|
exports.TimelineRotationField = TimelineRotationField;
|