@remotion/studio 4.0.507 → 4.0.508
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/components/CodingAgentIcon.d.ts +3 -1
- package/dist/components/CodingAgentIcon.js +4 -9
- 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/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 +44 -3
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/MenuBuildIndicator.js +1 -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 +237 -0
- package/dist/components/SelectedOutlineElement.d.ts +2 -1
- package/dist/components/SelectedOutlineElement.js +36 -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 +4 -3
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -0
- package/dist/components/SelectedOutlineRenderer.js +24 -7
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +1 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +7 -5
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +1 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +9 -5
- package/dist/components/SelectedOutlineTransformOriginHandle.js +48 -22
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsModalFooter.js +1 -1
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineFieldRowContent.js +10 -3
- 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 +45 -2
- package/dist/components/Timeline/TimelineSequenceItem.js +42 -1
- package/dist/components/Timeline/TimelineSequencePropItem.js +5 -2
- 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 +13 -6
- 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/use-open-sequence-in-apps.js +1 -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 +45 -9
- 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/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/get-open-in-menu-items.d.ts +6 -1
- package/dist/components/get-open-in-menu-items.js +69 -8
- 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/esm/{chunk-ptnd65a9.js → chunk-zpn4m49r.js} +8458 -6911
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +8458 -6911
- package/dist/esm/previewEntry.mjs +8363 -6816
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/open-in-editor.d.ts +3 -1
- package/dist/helpers/open-in-editor.js +5 -1
- 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/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/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/state/transform-3d-mode.d.ts +10 -0
- package/dist/state/transform-3d-mode.js +27 -0
- package/dist/state/z-index.js +5 -8
- package/package.json +12 -12
|
@@ -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;
|
|
@@ -10,11 +10,16 @@ const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
|
10
10
|
const timeline_field_display_utils_1 = require("./timeline-field-display-utils");
|
|
11
11
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
12
12
|
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
13
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
13
14
|
const leftDraggerStyle = {
|
|
15
|
+
paddingBottom: 2,
|
|
14
16
|
paddingLeft: 0,
|
|
17
|
+
paddingTop: 2,
|
|
15
18
|
};
|
|
16
19
|
const rightDraggerStyle = {
|
|
20
|
+
paddingBottom: 2,
|
|
17
21
|
paddingRight: 0,
|
|
22
|
+
paddingTop: 2,
|
|
18
23
|
};
|
|
19
24
|
const containerStyle = {
|
|
20
25
|
alignItems: 'center',
|
|
@@ -82,9 +87,12 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
82
87
|
var _a, _b;
|
|
83
88
|
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
84
89
|
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
90
|
+
const [dragZ, setDragZ] = (0, react_1.useState)(null);
|
|
85
91
|
const dragStartRef = (0, react_1.useRef)(null);
|
|
86
92
|
const { getScaleLockState, setScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
93
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
87
94
|
const [codeX, codeY, codeZ] = (0, react_1.useMemo)(() => no_react_1.NoReactInternals.parseScaleValue(effectiveValue), [effectiveValue]);
|
|
95
|
+
const show3D = transform3DMode || codeZ !== 1;
|
|
88
96
|
const defaultLinked = codeX === codeY;
|
|
89
97
|
const linked = getScaleLockState({
|
|
90
98
|
nodePath: scaleLockNodePath,
|
|
@@ -111,9 +119,9 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
111
119
|
}
|
|
112
120
|
return dragStartRef.current;
|
|
113
121
|
}, [codeX, codeY, dragX, dragY]);
|
|
114
|
-
const serialize = (0, react_1.useCallback)((x, y) => {
|
|
115
|
-
return no_react_1.NoReactInternals.serializeScaleValue([x, y,
|
|
116
|
-
}, [codeZ]);
|
|
122
|
+
const serialize = (0, react_1.useCallback)((x, y, z = dragZ !== null && dragZ !== void 0 ? dragZ : codeZ) => {
|
|
123
|
+
return no_react_1.NoReactInternals.serializeScaleValue([x, y, z]);
|
|
124
|
+
}, [codeZ, dragZ]);
|
|
117
125
|
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
118
126
|
if (linked) {
|
|
119
127
|
const [baseX, baseY] = getDragStart();
|
|
@@ -161,6 +169,7 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
161
169
|
dragStartRef.current = null;
|
|
162
170
|
setDragX(null);
|
|
163
171
|
setDragY(null);
|
|
172
|
+
setDragZ(null);
|
|
164
173
|
onDragEnd();
|
|
165
174
|
};
|
|
166
175
|
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
@@ -204,6 +213,7 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
204
213
|
dragStartRef.current = null;
|
|
205
214
|
setDragX(null);
|
|
206
215
|
setDragY(null);
|
|
216
|
+
setDragZ(null);
|
|
207
217
|
});
|
|
208
218
|
}
|
|
209
219
|
}, [codeX, codeY, dragY, linked, max, min, onSave, propStatus, serialize]);
|
|
@@ -254,6 +264,7 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
254
264
|
dragStartRef.current = null;
|
|
255
265
|
setDragX(null);
|
|
256
266
|
setDragY(null);
|
|
267
|
+
setDragZ(null);
|
|
257
268
|
onDragEnd();
|
|
258
269
|
};
|
|
259
270
|
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
@@ -297,6 +308,7 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
297
308
|
dragStartRef.current = null;
|
|
298
309
|
setDragX(null);
|
|
299
310
|
setDragY(null);
|
|
311
|
+
setDragZ(null);
|
|
300
312
|
});
|
|
301
313
|
}
|
|
302
314
|
}, [codeX, codeY, dragX, linked, max, min, onSave, propStatus, serialize]);
|
|
@@ -307,8 +319,50 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
|
|
|
307
319
|
linked: !linked,
|
|
308
320
|
});
|
|
309
321
|
}, [field.key, linked, scaleLockNodePath, setScaleLockState]);
|
|
322
|
+
const onZChange = (0, react_1.useCallback)((newVal) => {
|
|
323
|
+
setDragZ(newVal);
|
|
324
|
+
onDragValueChange(serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, newVal));
|
|
325
|
+
}, [codeX, codeY, dragX, dragY, onDragValueChange, serialize]);
|
|
326
|
+
const onZChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
327
|
+
const newScale = serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, newVal);
|
|
328
|
+
const clearDragState = () => {
|
|
329
|
+
dragStartRef.current = null;
|
|
330
|
+
setDragX(null);
|
|
331
|
+
setDragY(null);
|
|
332
|
+
setDragZ(null);
|
|
333
|
+
onDragEnd();
|
|
334
|
+
};
|
|
335
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
336
|
+
onSave(newScale).finally(clearDragState);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
clearDragState();
|
|
340
|
+
}
|
|
341
|
+
}, [
|
|
342
|
+
codeX,
|
|
343
|
+
codeY,
|
|
344
|
+
dragX,
|
|
345
|
+
dragY,
|
|
346
|
+
onDragEnd,
|
|
347
|
+
onSave,
|
|
348
|
+
propStatus.codeValue,
|
|
349
|
+
serialize,
|
|
350
|
+
]);
|
|
351
|
+
const onZTextChange = (0, react_1.useCallback)((newVal) => {
|
|
352
|
+
const parsed = Number(newVal);
|
|
353
|
+
if (Number.isNaN(parsed)) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const newScale = serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, parsed);
|
|
357
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
358
|
+
setDragZ(parsed);
|
|
359
|
+
onSave(newScale).finally(() => setDragZ(null));
|
|
360
|
+
}
|
|
361
|
+
}, [codeX, codeY, dragX, dragY, onSave, propStatus.codeValue, serialize]);
|
|
310
362
|
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
311
|
-
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, allowStepMismatch: true }), jsx_runtime_1.jsx("div", { style: gapStyle }), 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, allowStepMismatch: true }), jsx_runtime_1.
|
|
363
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, buttonStyle: leftDraggerStyle, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false, allowStepMismatch: true, "aria-label": "Scale X" }), jsx_runtime_1.jsx("div", { style: gapStyle }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false, allowStepMismatch: true, "aria-label": "Scale Y" }), show3D ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
364
|
+
jsx_runtime_1.jsx("div", { style: gapStyle }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragZ !== null && dragZ !== void 0 ? dragZ : codeZ, buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onZChange, onValueChangeEnd: onZChangeEnd, onTextChange: onZTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false, allowStepMismatch: true, "aria-label": "Scale Z" })
|
|
365
|
+
] })) : null, jsx_runtime_1.jsx(LinkToggle, { linked: linked, onToggle: onToggleLink })
|
|
312
366
|
] }));
|
|
313
367
|
};
|
|
314
368
|
exports.TimelineScaleField = TimelineScaleField;
|
|
@@ -161,6 +161,10 @@ export declare const getTimelineSequenceSelectionKey: (nodePathInfo: SequenceNod
|
|
|
161
161
|
export declare const TimelineSelectAllKeybindings: React.FC<{
|
|
162
162
|
readonly timeline: readonly TimelineTrackData[];
|
|
163
163
|
}>;
|
|
164
|
+
export declare const getTimelineSequenceSelectionForEscape: (selectedItems: readonly TimelineSelection[]) => {
|
|
165
|
+
readonly type: "sequence";
|
|
166
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
167
|
+
} | null;
|
|
164
168
|
export declare const TimelineSelectableItemsProvider: React.FC<{
|
|
165
169
|
readonly children: React.ReactNode;
|
|
166
170
|
readonly timeline: readonly TimelineTrackData[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTimelineRowHighlightBackground = exports.useTimelineRowContainsSelection = exports.useTimelineGuideSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineFocusableItem = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectableItemsProvider = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineItems = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.TimelineSelectionOrderProvider = exports.extendTimelineMarqueeSelection = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getAvailableTimelineSelectionState = exports.getTimelineSelectionAfterInteraction = exports.EMPTY_TIMELINE_SELECTION_STATE = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineRowHighlightBackground = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_HOVER_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
|
|
3
|
+
exports.useTimelineRowHighlightBackground = exports.useTimelineRowContainsSelection = exports.useTimelineGuideSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineFocusableItem = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectableItemsProvider = exports.getTimelineSequenceSelectionForEscape = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineItems = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.TimelineSelectionOrderProvider = exports.extendTimelineMarqueeSelection = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getAvailableTimelineSelectionState = exports.getTimelineSelectionAfterInteraction = exports.EMPTY_TIMELINE_SELECTION_STATE = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineRowHighlightBackground = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_HOVER_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -18,6 +18,7 @@ const options_sidebar_tabs_1 = require("../options-sidebar-tabs");
|
|
|
18
18
|
const get_node_keyframes_1 = require("./get-node-keyframes");
|
|
19
19
|
const get_timeline_easing_segments_1 = require("./get-timeline-easing-segments");
|
|
20
20
|
const imperative_state_1 = require("./imperative-state");
|
|
21
|
+
const parse_keyframe_field_from_node_path_1 = require("./parse-keyframe-field-from-node-path");
|
|
21
22
|
const timeline_expanded_filter_1 = require("./timeline-expanded-filter");
|
|
22
23
|
const timeline_refs_1 = require("./timeline-refs");
|
|
23
24
|
const TimelineClipboardKeybindings_1 = require("./TimelineClipboardKeybindings");
|
|
@@ -543,6 +544,42 @@ const TimelineSelectAllKeybindings = ({ timeline }) => {
|
|
|
543
544
|
return null;
|
|
544
545
|
};
|
|
545
546
|
exports.TimelineSelectAllKeybindings = TimelineSelectAllKeybindings;
|
|
547
|
+
const fieldsSelectingSequenceOnEscape = new Set([
|
|
548
|
+
'cropLeft',
|
|
549
|
+
'cropRight',
|
|
550
|
+
'cropTop',
|
|
551
|
+
'cropBottom',
|
|
552
|
+
'style.rotate',
|
|
553
|
+
]);
|
|
554
|
+
const getTimelineSequenceSelectionForEscape = (selectedItems) => {
|
|
555
|
+
if (selectedItems.length !== 1) {
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
558
|
+
const [selectedItem] = selectedItems;
|
|
559
|
+
let fieldKey = null;
|
|
560
|
+
if (selectedItem.type === 'sequence-prop') {
|
|
561
|
+
fieldKey = selectedItem.key;
|
|
562
|
+
}
|
|
563
|
+
else if (selectedItem.type === 'keyframe' ||
|
|
564
|
+
selectedItem.type === 'easing') {
|
|
565
|
+
const field = (0, parse_keyframe_field_from_node_path_1.parseKeyframeFieldFromNodePath)(selectedItem.nodePathInfo.auxiliaryKeys);
|
|
566
|
+
fieldKey = (field === null || field === void 0 ? void 0 : field.type) === 'sequence' ? field.fieldKey : null;
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
if (!fieldsSelectingSequenceOnEscape.has(fieldKey !== null && fieldKey !== void 0 ? fieldKey : '')) {
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
type: 'sequence',
|
|
576
|
+
nodePathInfo: {
|
|
577
|
+
...selectedItem.nodePathInfo,
|
|
578
|
+
auxiliaryKeys: [],
|
|
579
|
+
},
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
exports.getTimelineSequenceSelectionForEscape = getTimelineSequenceSelectionForEscape;
|
|
546
583
|
const TimelineEscapeKeybindings = () => {
|
|
547
584
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
548
585
|
const currentSelection = (0, exports.useCurrentTimelineSelectionStateAsRef)();
|
|
@@ -551,10 +588,16 @@ const TimelineEscapeKeybindings = () => {
|
|
|
551
588
|
event: 'keydown',
|
|
552
589
|
key: 'Escape',
|
|
553
590
|
callback: (event) => {
|
|
554
|
-
const { selectedItems, clearSelection } = currentSelection.current;
|
|
591
|
+
const { selectedItems, clearSelection, selectItems } = currentSelection.current;
|
|
555
592
|
if (selectedItems.length === 0) {
|
|
556
593
|
return;
|
|
557
594
|
}
|
|
595
|
+
const sequenceSelection = (0, exports.getTimelineSequenceSelectionForEscape)(selectedItems);
|
|
596
|
+
if (sequenceSelection) {
|
|
597
|
+
selectItems([sequenceSelection]);
|
|
598
|
+
event.preventDefault();
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
558
601
|
clearSelection();
|
|
559
602
|
event.preventDefault();
|
|
560
603
|
},
|
|
@@ -48,6 +48,7 @@ const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
|
48
48
|
const use_runtime_values_1 = require("../../helpers/use-runtime-values");
|
|
49
49
|
const modals_1 = require("../../state/modals");
|
|
50
50
|
const timeline_sequence_hover_1 = require("../../state/timeline-sequence-hover");
|
|
51
|
+
const transform_3d_mode_1 = require("../../state/transform-3d-mode");
|
|
51
52
|
const call_api_1 = require("../call-api");
|
|
52
53
|
const CompositionOrStillIcon_1 = require("../CompositionOrStillIcon");
|
|
53
54
|
const ConfirmationDialog_1 = require("../ConfirmationDialog");
|
|
@@ -658,6 +659,8 @@ const TimelineSequenceItemInner = ({ children, connectedCompositions, nestedDept
|
|
|
658
659
|
});
|
|
659
660
|
},
|
|
660
661
|
});
|
|
662
|
+
const canRotate = nodePathInfo !== null;
|
|
663
|
+
const { setManuallyEnabled } = (0, react_1.useContext)(transform_3d_mode_1.Transform3DModeStateContext);
|
|
661
664
|
const onAddEffect = (0, react_1.useCallback)(() => {
|
|
662
665
|
if (!canAddEffect ||
|
|
663
666
|
previewServerState.type !== 'connected' ||
|
|
@@ -691,6 +694,20 @@ const TimelineSequenceItemInner = ({ children, connectedCompositions, nestedDept
|
|
|
691
694
|
key: selected_outline_types_1.cropFieldKeys.left,
|
|
692
695
|
}, undefined, undefined, { reveal: true });
|
|
693
696
|
}, [canCrop, nodePathInfo, selectItem]);
|
|
697
|
+
const onRotate = (0, react_1.useCallback)(() => {
|
|
698
|
+
if (!canRotate || !nodePathInfo) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
setManuallyEnabled((0, TimelineSelection_1.getTimelineSequenceSelectionKey)(nodePathInfo), true);
|
|
702
|
+
selectItem({
|
|
703
|
+
type: 'sequence-prop',
|
|
704
|
+
nodePathInfo: {
|
|
705
|
+
...nodePathInfo,
|
|
706
|
+
auxiliaryKeys: ['controls', selected_outline_types_1.rotateFieldKey],
|
|
707
|
+
},
|
|
708
|
+
key: selected_outline_types_1.rotateFieldKey,
|
|
709
|
+
}, undefined, undefined, { reveal: true });
|
|
710
|
+
}, [canRotate, nodePathInfo, selectItem, setManuallyEnabled]);
|
|
694
711
|
const getContextMenuItems = (0, react_1.useCallback)(() => {
|
|
695
712
|
var _a;
|
|
696
713
|
if (selectable) {
|
|
@@ -769,9 +786,31 @@ const TimelineSequenceItemInner = ({ children, connectedCompositions, nestedDept
|
|
|
769
786
|
subMenu: null,
|
|
770
787
|
value: 'crop',
|
|
771
788
|
},
|
|
789
|
+
]
|
|
790
|
+
: []),
|
|
791
|
+
...(canRotate
|
|
792
|
+
? [
|
|
793
|
+
{
|
|
794
|
+
type: 'item',
|
|
795
|
+
id: 'rotate',
|
|
796
|
+
keyHint: null,
|
|
797
|
+
label: isProgrammaticallyDuplicated
|
|
798
|
+
? 'Rotate all'
|
|
799
|
+
: 'Rotate',
|
|
800
|
+
leftItem: null,
|
|
801
|
+
disabled: false,
|
|
802
|
+
onClick: onRotate,
|
|
803
|
+
quickSwitcherLabel: null,
|
|
804
|
+
subMenu: null,
|
|
805
|
+
value: 'rotate',
|
|
806
|
+
},
|
|
807
|
+
]
|
|
808
|
+
: []),
|
|
809
|
+
...(canCrop || canRotate
|
|
810
|
+
? [
|
|
772
811
|
{
|
|
773
812
|
type: 'divider',
|
|
774
|
-
id: '
|
|
813
|
+
id: 'transform-controls-divider',
|
|
775
814
|
},
|
|
776
815
|
]
|
|
777
816
|
: []),
|
|
@@ -796,6 +835,7 @@ const TimelineSequenceItemInner = ({ children, connectedCompositions, nestedDept
|
|
|
796
835
|
}, [
|
|
797
836
|
canAddEffect,
|
|
798
837
|
canCrop,
|
|
838
|
+
canRotate,
|
|
799
839
|
canConfigureApps,
|
|
800
840
|
canOpenInEditor,
|
|
801
841
|
canRenameThisSequence,
|
|
@@ -810,6 +850,7 @@ const TimelineSequenceItemInner = ({ children, connectedCompositions, nestedDept
|
|
|
810
850
|
nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.supportsEffects,
|
|
811
851
|
onAddEffect,
|
|
812
852
|
onCrop,
|
|
853
|
+
onRotate,
|
|
813
854
|
onDeleteSequenceFromSource,
|
|
814
855
|
onDisableSequenceInteractivity,
|
|
815
856
|
onDuplicateSequenceFromSource,
|
|
@@ -45,6 +45,7 @@ const InspectorPanelLayout_1 = require("../InspectorPanelLayout");
|
|
|
45
45
|
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
46
46
|
const get_sequence_prop_reset_changes_1 = require("./get-sequence-prop-reset-changes");
|
|
47
47
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
48
|
+
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
48
49
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
49
50
|
const TimelineFieldRowContent_1 = require("./TimelineFieldRowContent");
|
|
50
51
|
const TimelineKeyframeControls_1 = require("./TimelineKeyframeControls");
|
|
@@ -53,6 +54,7 @@ const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
|
53
54
|
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
54
55
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
55
56
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
57
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
56
58
|
const fieldRowBase = {};
|
|
57
59
|
const inlineSourceFieldRow = {
|
|
58
60
|
alignItems: 'stretch',
|
|
@@ -229,6 +231,7 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
229
231
|
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
230
232
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
231
233
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
234
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
232
235
|
const propStatusesForOverride = remotion_1.Internals.getPropStatusesCtx(visualModePropStatuses, nodePath);
|
|
233
236
|
const propStatus = (_a = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
234
237
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
@@ -248,10 +251,10 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
248
251
|
keyframable,
|
|
249
252
|
})) ? (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, nodePathInfo: nodePathInfo, mode: keyframeControlsMode })) : null;
|
|
250
253
|
const style = (0, react_1.useMemo)(() => {
|
|
251
|
-
return
|
|
254
|
+
return (0, timeline_field_row_layout_1.isTimelineFieldStacked)({ field, transform3DMode })
|
|
252
255
|
? fieldRowBase
|
|
253
256
|
: { ...fieldRowBase, height: field.rowHeight };
|
|
254
|
-
}, [field
|
|
257
|
+
}, [field, transform3DMode]);
|
|
255
258
|
const canResetToDefault = (0, react_1.useMemo)(() => {
|
|
256
259
|
if (!propStatus || propStatus.status === 'computed') {
|
|
257
260
|
return false;
|
|
@@ -8,21 +8,33 @@ const timeline_field_display_utils_1 = require("./timeline-field-display-utils")
|
|
|
8
8
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
9
9
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
10
10
|
const transform_origin_utils_1 = require("./transform-origin-utils");
|
|
11
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
11
12
|
const leftDraggerStyle = {
|
|
13
|
+
paddingBottom: 2,
|
|
12
14
|
paddingLeft: 0,
|
|
15
|
+
paddingTop: 2,
|
|
13
16
|
};
|
|
14
17
|
const rightDraggerStyle = {
|
|
18
|
+
paddingBottom: 2,
|
|
15
19
|
paddingRight: 0,
|
|
20
|
+
paddingTop: 2,
|
|
16
21
|
};
|
|
17
22
|
const containerStyle = {
|
|
18
23
|
display: 'flex',
|
|
19
24
|
gap: 4,
|
|
20
25
|
};
|
|
21
26
|
const TimelineTransformOriginField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
27
|
+
var _a;
|
|
22
28
|
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
23
29
|
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
30
|
+
const [dragZ, setDragZ] = (0, react_1.useState)(null);
|
|
31
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
24
32
|
const parsed = (0, react_1.useMemo)(() => (0, transform_origin_utils_1.parseTransformOrigin)(effectiveValue), [effectiveValue]);
|
|
25
33
|
const percent = (0, react_1.useMemo)(() => (parsed === null ? null : (0, transform_origin_utils_1.parsedTransformOriginToPercent)(parsed)), [parsed]);
|
|
34
|
+
const parsedZ = (0, react_1.useMemo)(() => (parsed === null || parsed === void 0 ? void 0 : parsed.z) === null || (parsed === null || parsed === void 0 ? void 0 : parsed.z) === undefined
|
|
35
|
+
? null
|
|
36
|
+
: (0, transform_origin_utils_1.parseTransformOriginZ)(parsed.z), [parsed === null || parsed === void 0 ? void 0 : parsed.z]);
|
|
37
|
+
const show3D = transform3DMode || (parsedZ !== null && parsedZ.value !== 0);
|
|
26
38
|
const configuredStep = field.fieldSchema.type === 'transform-origin'
|
|
27
39
|
? field.fieldSchema.step
|
|
28
40
|
: undefined;
|
|
@@ -37,14 +49,19 @@ const TimelineTransformOriginField = ({ field, propStatus, effectiveValue, onSav
|
|
|
37
49
|
value: v,
|
|
38
50
|
});
|
|
39
51
|
}, [field.fieldSchema]);
|
|
40
|
-
const serialize = (0, react_1.useCallback)((x, y) => {
|
|
52
|
+
const serialize = (0, react_1.useCallback)((x, y, z) => {
|
|
41
53
|
var _a;
|
|
54
|
+
if (z === void 0) { z = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.z) !== null && _a !== void 0 ? _a : null; }
|
|
42
55
|
return (0, transform_origin_utils_1.serializeTransformOrigin)({
|
|
43
56
|
uv: (0, transform_origin_utils_1.transformOriginPercentToUv)([x, y]),
|
|
44
|
-
z
|
|
57
|
+
z,
|
|
45
58
|
decimalPlaces,
|
|
46
59
|
});
|
|
47
60
|
}, [decimalPlaces, parsed === null || parsed === void 0 ? void 0 : parsed.z]);
|
|
61
|
+
const serializeZ = (0, react_1.useCallback)((value) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return `${(0, timeline_field_utils_1.normalizeTimelineNumber)(value)}${(_a = parsedZ === null || parsedZ === void 0 ? void 0 : parsedZ.unit) !== null && _a !== void 0 ? _a : 'px'}`;
|
|
64
|
+
}, [parsedZ === null || parsedZ === void 0 ? void 0 : parsedZ.unit]);
|
|
48
65
|
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
49
66
|
if (percent === null) {
|
|
50
67
|
return;
|
|
@@ -127,11 +144,68 @@ const TimelineTransformOriginField = ({ field, propStatus, effectiveValue, onSav
|
|
|
127
144
|
}
|
|
128
145
|
}
|
|
129
146
|
}, [dragX, onSave, percent, propStatus.codeValue, serialize]);
|
|
147
|
+
const onZChange = (0, react_1.useCallback)((newVal) => {
|
|
148
|
+
if (percent === null) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
setDragZ(newVal);
|
|
152
|
+
onDragValueChange(serialize(dragX !== null && dragX !== void 0 ? dragX : percent[0], dragY !== null && dragY !== void 0 ? dragY : percent[1], serializeZ(newVal)));
|
|
153
|
+
}, [dragX, dragY, onDragValueChange, percent, serialize, serializeZ]);
|
|
154
|
+
const onZChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
155
|
+
if (percent === null) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const value = serialize(dragX !== null && dragX !== void 0 ? dragX : percent[0], dragY !== null && dragY !== void 0 ? dragY : percent[1], serializeZ(newVal));
|
|
159
|
+
if (value !== propStatus.codeValue) {
|
|
160
|
+
onSave(value).finally(() => {
|
|
161
|
+
setDragZ(null);
|
|
162
|
+
onDragEnd();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
setDragZ(null);
|
|
167
|
+
onDragEnd();
|
|
168
|
+
}
|
|
169
|
+
}, [
|
|
170
|
+
dragX,
|
|
171
|
+
dragY,
|
|
172
|
+
onDragEnd,
|
|
173
|
+
onSave,
|
|
174
|
+
percent,
|
|
175
|
+
propStatus.codeValue,
|
|
176
|
+
serialize,
|
|
177
|
+
serializeZ,
|
|
178
|
+
]);
|
|
179
|
+
const onZTextChange = (0, react_1.useCallback)((newVal) => {
|
|
180
|
+
if (percent === null) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const parsedValue = Number(newVal);
|
|
184
|
+
if (!Number.isNaN(parsedValue)) {
|
|
185
|
+
const value = serialize(dragX !== null && dragX !== void 0 ? dragX : percent[0], dragY !== null && dragY !== void 0 ? dragY : percent[1], serializeZ(parsedValue));
|
|
186
|
+
if (value !== propStatus.codeValue) {
|
|
187
|
+
setDragZ(parsedValue);
|
|
188
|
+
onSave(value).finally(() => setDragZ(null));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, [
|
|
192
|
+
dragX,
|
|
193
|
+
dragY,
|
|
194
|
+
onSave,
|
|
195
|
+
percent,
|
|
196
|
+
propStatus.codeValue,
|
|
197
|
+
serialize,
|
|
198
|
+
serializeZ,
|
|
199
|
+
]);
|
|
130
200
|
if (percent === null) {
|
|
131
201
|
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "unsupported origin" });
|
|
132
202
|
}
|
|
133
203
|
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
134
|
-
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : percent[0], style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces }), 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 : percent[1], style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces })
|
|
135
|
-
|
|
204
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : percent[0], buttonStyle: leftDraggerStyle, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, "aria-label": "Transform origin X" }), 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 : percent[1], buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, "aria-label": "Transform origin Y" }), show3D ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
205
|
+
jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: (_a = dragZ !== null && dragZ !== void 0 ? dragZ : parsedZ === null || parsedZ === void 0 ? void 0 : parsedZ.value) !== null && _a !== void 0 ? _a : 0, buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onZChange, onValueChangeEnd: onZChangeEnd, onTextChange: onZTextChange, min: -Infinity, max: Infinity, step: step, formatter: (value) => {
|
|
206
|
+
var _a;
|
|
207
|
+
return `${value}${(_a = parsedZ === null || parsedZ === void 0 ? void 0 : parsedZ.unit) !== null && _a !== void 0 ? _a : 'px'}`;
|
|
208
|
+
}, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, "aria-label": "Transform origin Z" })
|
|
209
|
+
] })) : null] }));
|
|
136
210
|
};
|
|
137
211
|
exports.TimelineTransformOriginField = TimelineTransformOriginField;
|