@remotion/studio 4.0.506 → 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/api/copy-render-output-to-asset.d.ts +4 -0
- package/dist/api/copy-render-output-to-asset.js +11 -0
- package/dist/components/AssetSelector.js +19 -4
- package/dist/components/AssetSelectorItem.js +2 -2
- package/dist/components/CodingAgentIcon.d.ts +6 -0
- package/dist/components/CodingAgentIcon.js +12 -0
- package/dist/components/ConfigureDefaultEditorModal.d.ts +1 -3
- package/dist/components/ConfigureDefaultEditorModal.js +67 -77
- package/dist/components/ConfigureLicenseModal.d.ts +1 -4
- package/dist/components/ConfigureLicenseModal.js +89 -81
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +42 -13
- package/dist/components/EditorContent.js +4 -3
- package/dist/components/EditorContexts.js +6 -5
- package/dist/components/ExpandedTracksProvider.js +10 -53
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.js +8 -8
- package/dist/components/InspectorOpenInEditor.d.ts +2 -0
- package/dist/components/InspectorOpenInEditor.js +81 -50
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -0
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +22 -4
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/Menu/MenuSectionHeader.d.ts +4 -0
- package/dist/components/Menu/MenuSectionHeader.js +20 -0
- package/dist/components/Menu/SubMenu.js +13 -2
- package/dist/components/Menu/menu-tree-context.d.ts +3 -0
- package/dist/components/Menu/menu-tree-context.js +13 -0
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/NewComposition/ComboBox.d.ts +6 -1
- package/dist/components/NewComposition/MenuContent.js +27 -19
- package/dist/components/NewComposition/menu-typeahead.js +2 -2
- package/dist/components/PlayPause.d.ts +1 -1
- package/dist/components/PlayPause.js +61 -12
- package/dist/components/Preview.js +29 -4
- 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.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +3 -3
- 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 +8 -3
- 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 +2 -2
- 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/RenderModal/ServerRenderModal.js +4 -0
- package/dist/components/RenderQueue/RenderQueueItem.js +8 -2
- package/dist/components/RenderQueue/actions.d.ts +4 -2
- package/dist/components/RenderQueue/actions.js +4 -2
- package/dist/components/RenderQueue/index.js +3 -4
- package/dist/components/RenderQueue/use-render-output-file-drag.d.ts +8 -0
- package/dist/components/RenderQueue/use-render-output-file-drag.js +121 -0
- package/dist/components/SegmentedControl.js +0 -1
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +9 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +237 -0
- package/dist/components/SelectedOutlineElement.d.ts +16 -18
- package/dist/components/SelectedOutlineElement.js +144 -931
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +7 -0
- package/dist/components/SelectedOutlineKeyboardControls.js +261 -0
- package/dist/components/SelectedOutlineOverlay.d.ts +7 -14
- package/dist/components/SelectedOutlineOverlay.js +378 -864
- package/dist/components/SelectedOutlinePolygon.d.ts +26 -0
- package/dist/components/SelectedOutlinePolygon.js +360 -0
- package/dist/components/SelectedOutlineRenderer.d.ts +19 -0
- package/dist/components/SelectedOutlineRenderer.js +225 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +17 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +271 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +17 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +215 -0
- package/dist/components/SelectedOutlineSnapIndicators.d.ts +9 -0
- package/dist/components/SelectedOutlineSnapIndicators.js +29 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.d.ts +9 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.js +312 -0
- package/dist/components/SelectedOutlineUvControls.d.ts +3 -9
- package/dist/components/SelectedOutlineUvControls.js +57 -12
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsContext.d.ts +15 -0
- package/dist/components/SettingsContext.js +116 -0
- package/dist/components/SettingsModal.js +10 -4
- package/dist/components/SettingsModalFooter.d.ts +1 -3
- package/dist/components/SettingsModalFooter.js +4 -6
- package/dist/components/ShowOutlinesProvider.js +2 -3
- package/dist/components/Timeline/EasingEditorModal.js +66 -22
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/Timeline.js +22 -5
- package/dist/components/Timeline/TimelineDuplicateCount.d.ts +4 -0
- package/dist/components/Timeline/TimelineDuplicateCount.js +28 -0
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +3 -23
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +4 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -1
- 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/TimelineSequence.js +28 -25
- package/dist/components/Timeline/TimelineSequenceItem.js +91 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +5 -2
- package/dist/components/Timeline/TimelineTrack.js +2 -1
- 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.d.ts +6 -3
- package/dist/components/Timeline/get-sequence-context-menu-items.js +69 -57
- 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-expanded-track-keyframe-rows.js +36 -4
- package/dist/components/Timeline/{use-open-sequence-in-editor.d.ts → use-open-sequence-in-apps.d.ts} +4 -1
- package/dist/components/Timeline/{use-open-sequence-in-editor.js → use-open-sequence-in-apps.js} +21 -5
- 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/Timeline/use-timeline-expanded-tree.d.ts +4 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +45 -1
- 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 +17 -0
- package/dist/components/get-open-in-menu-items.js +144 -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 +7 -2
- package/dist/components/selected-outline-measurement.js +28 -1
- package/dist/components/selected-outline-order.d.ts +12 -0
- package/dist/components/selected-outline-order.js +251 -0
- package/dist/components/selected-outline-types.d.ts +15 -10
- package/dist/components/svg-point-to-client-point.d.ts +2 -0
- package/dist/components/svg-point-to-client-point.js +10 -0
- package/dist/components/use-auto-save-config.d.ts +8 -0
- package/dist/components/use-auto-save-config.js +74 -0
- package/dist/components/use-default-editor-info.d.ts +1 -0
- package/dist/components/use-default-editor-info.js +10 -30
- package/dist/esm/{chunk-jefhcs5z.js → chunk-fgedsvhb.js} +1 -2
- package/dist/esm/{chunk-b49ec3nz.js → chunk-zpn4m49r.js} +12924 -10139
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +12923 -10138
- package/dist/esm/previewEntry.mjs +12771 -9986
- package/dist/esm/renderEntry.mjs +2 -2
- package/dist/helpers/are-sequence-node-path-infos-equal.d.ts +2 -0
- package/dist/helpers/are-sequence-node-path-infos-equal.js +27 -0
- package/dist/helpers/calculate-timeline.js +3 -3
- package/dist/helpers/client-id.js +8 -1
- package/dist/helpers/format-file-location.d.ts +1 -1
- package/dist/helpers/format-file-location.js +3 -3
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
- package/dist/helpers/open-in-editor.d.ts +4 -1
- package/dist/helpers/open-in-editor.js +9 -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/helpers/studio-runtime-config.js +3 -0
- package/dist/helpers/timeline-node-path-key.d.ts +2 -0
- package/dist/helpers/timeline-node-path-key.js +3 -1
- package/dist/helpers/use-asset-drag-events.d.ts +2 -1
- package/dist/helpers/use-asset-drag-events.js +14 -6
- package/dist/helpers/use-menu-structure.js +2 -2
- package/dist/helpers/use-runtime-values.d.ts +1 -3
- 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/timeline-sequence-hover.d.ts +9 -3
- package/dist/state/timeline-sequence-hover.js +63 -12
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.snapSelectedOutlineUv = exports.selectedOutlineUvSnapThresholdPx = exports.applySelectedOutlineTransformOriginAxisLock = exports.getSelectedOutlineTransformOriginLockedAxis = exports.uvsEqual = exports.getSelectedOutlineTransformOriginDragChanges = exports.compensateTranslateForTransformOrigin = exports.
|
|
3
|
+
exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.snapSelectedOutlineUv = exports.selectedOutlineUvSnapThresholdPx = exports.applySelectedOutlineTransformOriginAxisLock = exports.getSelectedOutlineTransformOriginLockedAxis = exports.uvsEqual = exports.getSelectedOutlineTransformOriginDragChanges = exports.compensateTranslateForTransformOrigin = exports.clearSelectedOutlineRotationDragOverrides = exports.clearSelectedOutlineScaleDragOverrides = exports.getSelectedOutlineKeyboardNudgeDirection = exports.clearSelectedOutlineDragOverrides = exports.getSelectedOutlineRotationDragChanges = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineRotationSnapStepDegrees = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutline3DRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineCropDragChanges = exports.getSelectedOutlineCropDragValues = exports.getSelectedOutlineCropFollowingTransformOrigin = exports.getSelectedOutlineDragChanges = exports.isSelectedOutlineDragPastThreshold = exports.applySelectedOutlineDragAxisLock = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragStates = exports.getSelectedOutlineActiveSchema = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
5
|
const no_react_1 = require("remotion/no-react");
|
|
6
6
|
const selected_outline_geometry_1 = require("./selected-outline-geometry");
|
|
@@ -35,7 +35,7 @@ const getSelectedOutlineDragStates = ({ dragTargets, getDragOverrides, timelineP
|
|
|
35
35
|
frame: sourceFrame,
|
|
36
36
|
shouldResortToDefaultValueIfUndefined: true,
|
|
37
37
|
});
|
|
38
|
-
const [startX, startY] = (0, timeline_translate_utils_1.parseTranslate)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px'));
|
|
38
|
+
const [startX, startY, startZ] = (0, timeline_translate_utils_1.parseTranslate)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px'));
|
|
39
39
|
return {
|
|
40
40
|
defaultValue: target.fieldDefault !== undefined
|
|
41
41
|
? JSON.stringify(target.fieldDefault)
|
|
@@ -44,6 +44,7 @@ const getSelectedOutlineDragStates = ({ dragTargets, getDragOverrides, timelineP
|
|
|
44
44
|
sourceFrame,
|
|
45
45
|
startX,
|
|
46
46
|
startY,
|
|
47
|
+
startZ,
|
|
47
48
|
target,
|
|
48
49
|
};
|
|
49
50
|
});
|
|
@@ -52,7 +53,11 @@ exports.getSelectedOutlineDragStates = getSelectedOutlineDragStates;
|
|
|
52
53
|
const getSelectedOutlineDragValues = ({ dragStates, deltaX, deltaY, }) => {
|
|
53
54
|
return new Map(dragStates.map((dragState) => [
|
|
54
55
|
dragState.key,
|
|
55
|
-
(0, timeline_translate_utils_1.serializeTranslate)(
|
|
56
|
+
(0, timeline_translate_utils_1.serializeTranslate)([
|
|
57
|
+
dragState.startX + deltaX,
|
|
58
|
+
dragState.startY + deltaY,
|
|
59
|
+
dragState.startZ,
|
|
60
|
+
]),
|
|
56
61
|
]));
|
|
57
62
|
};
|
|
58
63
|
exports.getSelectedOutlineDragValues = getSelectedOutlineDragValues;
|
|
@@ -78,7 +83,11 @@ const getSelectedOutlineDragChanges = ({ dragStates, lastValues, }) => {
|
|
|
78
83
|
continue;
|
|
79
84
|
}
|
|
80
85
|
if (dragState.target.propStatus.status === 'keyframed') {
|
|
81
|
-
const startValue = (0, timeline_translate_utils_1.serializeTranslate)(
|
|
86
|
+
const startValue = (0, timeline_translate_utils_1.serializeTranslate)([
|
|
87
|
+
dragState.startX,
|
|
88
|
+
dragState.startY,
|
|
89
|
+
dragState.startZ,
|
|
90
|
+
]);
|
|
82
91
|
if (value === startValue) {
|
|
83
92
|
continue;
|
|
84
93
|
}
|
|
@@ -426,24 +435,62 @@ const getSelectedOutlineRotationDragStates = ({ dragTargets, getDragOverrides, t
|
|
|
426
435
|
frame: sourceFrame,
|
|
427
436
|
shouldResortToDefaultValueIfUndefined: true,
|
|
428
437
|
});
|
|
438
|
+
const startValue = String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg');
|
|
429
439
|
return {
|
|
430
440
|
defaultValue: target.fieldDefault !== undefined
|
|
431
441
|
? JSON.stringify(target.fieldDefault)
|
|
432
442
|
: null,
|
|
433
443
|
key: remotion_1.Internals.makeSequencePropsSubscriptionKey(target.nodePath),
|
|
434
444
|
sourceFrame,
|
|
435
|
-
startDegrees: (0, timeline_rotation_utils_1.parseCssRotationToDegrees)(
|
|
445
|
+
startDegrees: (0, timeline_rotation_utils_1.parseCssRotationToDegrees)(startValue),
|
|
446
|
+
startRotation: (0, timeline_rotation_utils_1.parseCssRotationToEuler)(startValue),
|
|
447
|
+
startValue,
|
|
436
448
|
target,
|
|
437
449
|
};
|
|
438
450
|
});
|
|
439
451
|
};
|
|
440
452
|
exports.getSelectedOutlineRotationDragStates = getSelectedOutlineRotationDragStates;
|
|
453
|
+
const getSelectedOutline3DRotationDragValues = ({ dragStates, rotationXDeltaDegrees, rotationYDeltaDegrees, }) => {
|
|
454
|
+
return new Map(dragStates.map((dragState) => {
|
|
455
|
+
const decimalPlaces = Math.max(6, (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
456
|
+
defaultDecimalPlaces: 1,
|
|
457
|
+
step: dragState.target.fieldSchema.step,
|
|
458
|
+
}));
|
|
459
|
+
const { startRotation } = dragState;
|
|
460
|
+
return [
|
|
461
|
+
dragState.key,
|
|
462
|
+
(0, timeline_rotation_utils_1.serializeCssRotationFromEuler)({
|
|
463
|
+
rotation: [
|
|
464
|
+
startRotation[0] + rotationXDeltaDegrees,
|
|
465
|
+
startRotation[1] + rotationYDeltaDegrees,
|
|
466
|
+
startRotation[2],
|
|
467
|
+
],
|
|
468
|
+
decimalPlaces,
|
|
469
|
+
}),
|
|
470
|
+
];
|
|
471
|
+
}));
|
|
472
|
+
};
|
|
473
|
+
exports.getSelectedOutline3DRotationDragValues = getSelectedOutline3DRotationDragValues;
|
|
441
474
|
const getSelectedOutlineRotationDragValues = ({ dragStates, rotationDeltaDegrees, }) => {
|
|
442
475
|
return new Map(dragStates.map((dragState) => {
|
|
443
476
|
const decimalPlaces = (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
444
477
|
defaultDecimalPlaces: 1,
|
|
445
478
|
step: dragState.target.fieldSchema.step,
|
|
446
479
|
});
|
|
480
|
+
const { startRotation } = dragState;
|
|
481
|
+
if (dragState.target.transform3DMode) {
|
|
482
|
+
return [
|
|
483
|
+
dragState.key,
|
|
484
|
+
(0, timeline_rotation_utils_1.serializeCssRotationFromEuler)({
|
|
485
|
+
rotation: [
|
|
486
|
+
startRotation[0],
|
|
487
|
+
startRotation[1],
|
|
488
|
+
startRotation[2] + rotationDeltaDegrees,
|
|
489
|
+
],
|
|
490
|
+
decimalPlaces: Math.max(6, decimalPlaces),
|
|
491
|
+
}),
|
|
492
|
+
];
|
|
493
|
+
}
|
|
447
494
|
return [
|
|
448
495
|
dragState.key,
|
|
449
496
|
(0, timeline_rotation_utils_1.serializeCssRotation)(dragState.startDegrees + rotationDeltaDegrees, decimalPlaces),
|
|
@@ -457,10 +504,11 @@ const snapSelectedOutlineRotationDeltaDegrees = ({ dragStates, rotationDeltaDegr
|
|
|
457
504
|
if (anchor === undefined) {
|
|
458
505
|
return rotationDeltaDegrees;
|
|
459
506
|
}
|
|
460
|
-
|
|
507
|
+
const startDegrees = anchor.startRotation[2];
|
|
508
|
+
return (Math.round((startDegrees + rotationDeltaDegrees) /
|
|
461
509
|
exports.selectedOutlineRotationSnapStepDegrees) *
|
|
462
510
|
exports.selectedOutlineRotationSnapStepDegrees -
|
|
463
|
-
|
|
511
|
+
startDegrees);
|
|
464
512
|
};
|
|
465
513
|
exports.snapSelectedOutlineRotationDeltaDegrees = snapSelectedOutlineRotationDeltaDegrees;
|
|
466
514
|
const getSelectedOutlineRotationDragChanges = ({ dragStates, lastValues, }) => {
|
|
@@ -471,11 +519,7 @@ const getSelectedOutlineRotationDragChanges = ({ dragStates, lastValues, }) => {
|
|
|
471
519
|
continue;
|
|
472
520
|
}
|
|
473
521
|
if (dragState.target.propStatus.status === 'keyframed') {
|
|
474
|
-
const
|
|
475
|
-
defaultDecimalPlaces: 1,
|
|
476
|
-
step: dragState.target.fieldSchema.step,
|
|
477
|
-
});
|
|
478
|
-
const startValue = (0, timeline_rotation_utils_1.serializeCssRotation)(dragState.startDegrees, decimalPlaces);
|
|
522
|
+
const { startValue } = dragState;
|
|
479
523
|
if (value === startValue) {
|
|
480
524
|
continue;
|
|
481
525
|
}
|
|
@@ -545,36 +589,26 @@ const clearSelectedOutlineRotationDragOverrides = ({ clearDragOverrides, dragSta
|
|
|
545
589
|
}
|
|
546
590
|
};
|
|
547
591
|
exports.clearSelectedOutlineRotationDragOverrides = clearSelectedOutlineRotationDragOverrides;
|
|
548
|
-
const
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
if (!Number.isFinite(number)) {
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
if (match[2] === 'rad') {
|
|
560
|
-
return number;
|
|
561
|
-
}
|
|
562
|
-
if (match[2] === 'turn') {
|
|
563
|
-
return number * Math.PI * 2;
|
|
564
|
-
}
|
|
565
|
-
if (match[2] === 'grad') {
|
|
566
|
-
return (number / 400) * Math.PI * 2;
|
|
592
|
+
const compensateTranslateForTransformOrigin = ({ startTranslate, deltaOrigin, rotation, scale, }) => {
|
|
593
|
+
const [rawAxisX, rawAxisY, rawAxisZ] = rotation.axis;
|
|
594
|
+
const axisLength = Math.hypot(rawAxisX, rawAxisY, rawAxisZ);
|
|
595
|
+
if (axisLength === 0) {
|
|
596
|
+
return [
|
|
597
|
+
startTranslate[0] + deltaOrigin[0] * (scale[0] - 1),
|
|
598
|
+
startTranslate[1] + deltaOrigin[1] * (scale[1] - 1),
|
|
599
|
+
];
|
|
567
600
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
const cos = Math.cos(
|
|
573
|
-
const sin = Math.sin(
|
|
574
|
-
const
|
|
575
|
-
const
|
|
576
|
-
const
|
|
577
|
-
const
|
|
601
|
+
const axisX = rawAxisX / axisLength;
|
|
602
|
+
const axisY = rawAxisY / axisLength;
|
|
603
|
+
const axisZ = rawAxisZ / axisLength;
|
|
604
|
+
const radians = (rotation.degrees * Math.PI) / 180;
|
|
605
|
+
const cos = Math.cos(radians);
|
|
606
|
+
const sin = Math.sin(radians);
|
|
607
|
+
const oneMinusCos = 1 - cos;
|
|
608
|
+
const matrixA = (cos + axisX * axisX * oneMinusCos) * scale[0];
|
|
609
|
+
const matrixB = (axisY * axisX * oneMinusCos + axisZ * sin) * scale[0];
|
|
610
|
+
const matrixC = (axisX * axisY * oneMinusCos - axisZ * sin) * scale[1];
|
|
611
|
+
const matrixD = (cos + axisY * axisY * oneMinusCos) * scale[1];
|
|
578
612
|
const transformedDeltaX = matrixA * deltaOrigin[0] + matrixC * deltaOrigin[1];
|
|
579
613
|
const transformedDeltaY = matrixB * deltaOrigin[0] + matrixD * deltaOrigin[1];
|
|
580
614
|
const compensationX = deltaOrigin[0] - transformedDeltaX;
|
|
@@ -648,7 +682,11 @@ const getSelectedOutlineTransformOriginDragChanges = ({ target, startTranslate,
|
|
|
648
682
|
nodePath: target.nodePath,
|
|
649
683
|
fieldKey: selected_outline_types_1.translateFieldKey,
|
|
650
684
|
sourceFrame: keyframe.frame,
|
|
651
|
-
value: (0, timeline_translate_utils_1.serializeTranslate)(
|
|
685
|
+
value: (0, timeline_translate_utils_1.serializeTranslate)([
|
|
686
|
+
keyframeTranslate[0] + deltaTranslateX,
|
|
687
|
+
keyframeTranslate[1] + deltaTranslateY,
|
|
688
|
+
keyframeTranslate[2],
|
|
689
|
+
]),
|
|
652
690
|
schema: target.schema,
|
|
653
691
|
});
|
|
654
692
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OverrideIdToNodePaths, TSequence } from 'remotion';
|
|
2
2
|
import type { OutlinePoint, SelectedOutline } from './selected-outline-geometry';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SelectedOutlineLayoutTarget, SequenceWithSelectedOutline } from './selected-outline-types';
|
|
4
4
|
import { type TimelineSelection, type TimelineSelectionInteraction } from './Timeline/TimelineSelection';
|
|
5
5
|
export declare const pointToString: (point: OutlinePoint) => string;
|
|
6
6
|
export declare const midpoint: (from: OutlinePoint, to: OutlinePoint) => OutlinePoint;
|
|
@@ -63,18 +63,23 @@ type SelectedTransformOriginInfo = {
|
|
|
63
63
|
readonly sequenceKey: string;
|
|
64
64
|
readonly displayFrame: number | null;
|
|
65
65
|
};
|
|
66
|
+
export type SelectedRotationInfo = {
|
|
67
|
+
readonly sequenceKey: string;
|
|
68
|
+
readonly displayFrame: number | null;
|
|
69
|
+
};
|
|
66
70
|
export type SelectedCropInfo = {
|
|
67
71
|
readonly sequenceKey: string;
|
|
68
72
|
readonly displayFrame: number | null;
|
|
69
73
|
};
|
|
70
74
|
export declare const getSelectedCropInfo: (selectedItems: readonly TimelineSelection[]) => SelectedCropInfo | null;
|
|
71
75
|
export declare const getSelectedTransformOriginInfo: (selectedItems: readonly TimelineSelection[]) => SelectedTransformOriginInfo | null;
|
|
76
|
+
export declare const getSelectedRotationInfo: (selectedItems: readonly TimelineSelection[]) => SelectedRotationInfo | null;
|
|
72
77
|
export declare const getSequencesWithSelectableOutlines: ({ sequences, overrideIdsToNodePaths, compositions, timelinePosition, }: {
|
|
73
78
|
readonly sequences: readonly TSequence[];
|
|
74
79
|
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
75
80
|
readonly compositions?: readonly import("remotion").AnyComposition[] | undefined;
|
|
76
81
|
readonly timelinePosition: number;
|
|
77
82
|
}) => SequenceWithSelectedOutline[];
|
|
78
|
-
export declare const measureOutlines: (container: SVGSVGElement, targets: readonly
|
|
83
|
+
export declare const measureOutlines: (container: SVGSVGElement, targets: readonly SelectedOutlineLayoutTarget[]) => SelectedOutline[];
|
|
79
84
|
export declare const outlinesAreEqual: (a: readonly SelectedOutline[], b: readonly SelectedOutline[]) => boolean;
|
|
80
85
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.outlinesAreEqual = exports.measureOutlines = exports.getSequencesWithSelectableOutlines = exports.getSelectedTransformOriginInfo = exports.getSelectedCropInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.cropOutlinePoints = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = void 0;
|
|
3
|
+
exports.outlinesAreEqual = exports.measureOutlines = exports.getSequencesWithSelectableOutlines = exports.getSelectedRotationInfo = exports.getSelectedTransformOriginInfo = exports.getSelectedCropInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.cropOutlinePoints = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = void 0;
|
|
4
4
|
const calculate_timeline_1 = require("../helpers/calculate-timeline");
|
|
5
5
|
const colors_1 = require("../helpers/colors");
|
|
6
6
|
const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
|
|
@@ -352,6 +352,33 @@ const getSelectedTransformOriginInfo = (selectedItems) => {
|
|
|
352
352
|
};
|
|
353
353
|
};
|
|
354
354
|
exports.getSelectedTransformOriginInfo = getSelectedTransformOriginInfo;
|
|
355
|
+
const getSelectedRotationInfo = (selectedItems) => {
|
|
356
|
+
if (selectedItems.length !== 1) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
const [selectedItem] = selectedItems;
|
|
360
|
+
if (selectedItem.type === 'sequence-prop' &&
|
|
361
|
+
selectedItem.key === selected_outline_types_1.rotateFieldKey) {
|
|
362
|
+
return {
|
|
363
|
+
sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
|
|
364
|
+
displayFrame: null,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
if (selectedItem.type !== 'keyframe' && selectedItem.type !== 'easing') {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
const field = getKeyframeOrEasingField(selectedItem);
|
|
371
|
+
if ((field === null || field === void 0 ? void 0 : field.type) !== 'sequence' || field.fieldKey !== selected_outline_types_1.rotateFieldKey) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
|
|
376
|
+
displayFrame: selectedItem.type === 'keyframe'
|
|
377
|
+
? selectedItem.frame
|
|
378
|
+
: selectedItem.fromFrame,
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
exports.getSelectedRotationInfo = getSelectedRotationInfo;
|
|
355
382
|
const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths, compositions = [], timelinePosition, }) => {
|
|
356
383
|
return (0, calculate_timeline_1.calculateTimeline)({
|
|
357
384
|
sequences: [...sequences],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SelectedOutline } from './selected-outline-geometry';
|
|
2
|
+
import type { SelectedOutlineLayoutTarget } from './selected-outline-types';
|
|
3
|
+
type OutlineSequenceParent = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly parent: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const orderOutlinesForRendering: ({ outlines, sequences, targetsByKey, }: {
|
|
8
|
+
readonly outlines: readonly SelectedOutline[];
|
|
9
|
+
readonly sequences: readonly OutlineSequenceParent[];
|
|
10
|
+
readonly targetsByKey: ReadonlyMap<string, SelectedOutlineLayoutTarget>;
|
|
11
|
+
}) => readonly SelectedOutline[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.orderOutlinesForRendering = void 0;
|
|
4
|
+
const outlinePointEqualityTolerance = 0.5;
|
|
5
|
+
const outlineAreaEqualityTolerance = 0.5;
|
|
6
|
+
const outlineBoundsOverlapTolerance = 0.5;
|
|
7
|
+
const outlinePointsAreEquivalent = (a, b) => {
|
|
8
|
+
return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
|
|
9
|
+
Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
|
|
10
|
+
};
|
|
11
|
+
const outlinesHaveEquivalentHitArea = (a, b) => {
|
|
12
|
+
if (a.points.length !== b.points.length) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
|
|
16
|
+
for (const direction of [1, -1]) {
|
|
17
|
+
const pointsMatch = a.points.every((point, index) => {
|
|
18
|
+
const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
|
|
19
|
+
return outlinePointsAreEquivalent(point, b.points[bIndex]);
|
|
20
|
+
});
|
|
21
|
+
if (pointsMatch) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
const getOutlineHitArea = (outline) => {
|
|
29
|
+
let area = 0;
|
|
30
|
+
for (let i = 0; i < outline.points.length; i++) {
|
|
31
|
+
const current = outline.points[i];
|
|
32
|
+
const next = outline.points[(i + 1) % outline.points.length];
|
|
33
|
+
area += current.x * next.y - next.x * current.y;
|
|
34
|
+
}
|
|
35
|
+
return Math.abs(area) / 2;
|
|
36
|
+
};
|
|
37
|
+
const getOutlineBounds = (outline) => {
|
|
38
|
+
const xs = outline.points.map((point) => point.x);
|
|
39
|
+
const ys = outline.points.map((point) => point.y);
|
|
40
|
+
return {
|
|
41
|
+
maxX: Math.max(...xs),
|
|
42
|
+
maxY: Math.max(...ys),
|
|
43
|
+
minX: Math.min(...xs),
|
|
44
|
+
minY: Math.min(...ys),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const outlineBoundsOverlap = (a, b) => {
|
|
48
|
+
const aBounds = getOutlineBounds(a);
|
|
49
|
+
const bBounds = getOutlineBounds(b);
|
|
50
|
+
return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
|
|
51
|
+
aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
|
|
52
|
+
aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
|
|
53
|
+
aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
|
|
54
|
+
};
|
|
55
|
+
const getSequenceId = (target) => {
|
|
56
|
+
var _a;
|
|
57
|
+
var _b;
|
|
58
|
+
return (_b = (_a = target === null || target === void 0 ? void 0 : target.sequence) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
59
|
+
};
|
|
60
|
+
const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
|
|
61
|
+
const parentBySequenceId = new Map();
|
|
62
|
+
for (const sequence of sequences) {
|
|
63
|
+
parentBySequenceId.set(sequence.id, sequence.parent);
|
|
64
|
+
}
|
|
65
|
+
for (const target of targetsByKey.values()) {
|
|
66
|
+
const sequenceId = getSequenceId(target);
|
|
67
|
+
if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
|
|
68
|
+
parentBySequenceId.set(sequenceId, target.sequence.parent);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return parentBySequenceId;
|
|
72
|
+
};
|
|
73
|
+
const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
|
|
74
|
+
var _a;
|
|
75
|
+
var _b, _c;
|
|
76
|
+
const ancestorId = getSequenceId(ancestor);
|
|
77
|
+
if (ancestorId === null) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
81
|
+
while (parentId !== null) {
|
|
82
|
+
if (parentId === ancestorId) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
|
|
90
|
+
var _a;
|
|
91
|
+
var _b, _c, _d, _e;
|
|
92
|
+
const incomingEdges = new Map();
|
|
93
|
+
const outgoingEdges = new Map();
|
|
94
|
+
const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
|
|
95
|
+
for (const outline of outlines) {
|
|
96
|
+
incomingEdges.set(outline.key, new Set());
|
|
97
|
+
outgoingEdges.set(outline.key, new Set());
|
|
98
|
+
}
|
|
99
|
+
const hasPath = ({ fromKey, seen, toKey, }) => {
|
|
100
|
+
var _a;
|
|
101
|
+
if (fromKey === toKey) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
if (seen.has(fromKey)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
seen.add(fromKey);
|
|
108
|
+
for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
|
|
109
|
+
if (hasPath({ fromKey: nextKey, seen, toKey })) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
const addEdge = (before, after, options) => {
|
|
116
|
+
if (before.key === after.key) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const incoming = incomingEdges.get(after.key);
|
|
120
|
+
const outgoing = outgoingEdges.get(before.key);
|
|
121
|
+
if (incoming === undefined || outgoing === undefined) {
|
|
122
|
+
throw new Error('Expected outline to be registered before adding edge');
|
|
123
|
+
}
|
|
124
|
+
if (outgoing.has(after.key)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
|
|
128
|
+
if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
throw new Error('Could not determine a stable outline rendering order');
|
|
132
|
+
}
|
|
133
|
+
incoming.add(before.key);
|
|
134
|
+
outgoing.add(after.key);
|
|
135
|
+
};
|
|
136
|
+
const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
|
|
137
|
+
// Usually, children should be above parents so nested elements are directly
|
|
138
|
+
// selectable. If an unselected child has the same hit area as its parent, put
|
|
139
|
+
// it below the parent so the wrapper can be selected. Once the child or
|
|
140
|
+
// one of its properties is selected, keep it above the parent so it remains
|
|
141
|
+
// directly draggable.
|
|
142
|
+
if (equivalentHitArea && !descendantContainsSelection) {
|
|
143
|
+
addEdge(descendant, ancestor);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
addEdge(ancestor, descendant);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const outlineBySequenceId = new Map();
|
|
150
|
+
for (const outline of outlines) {
|
|
151
|
+
const sequenceId = getSequenceId(targetsByKey.get(outline.key));
|
|
152
|
+
if (sequenceId !== null) {
|
|
153
|
+
outlineBySequenceId.set(sequenceId, outline);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Only constrain each outline against its nearest rendered ancestor. The
|
|
157
|
+
// resulting graph follows the sequence tree, so pairwise subpixel equivalence
|
|
158
|
+
// cannot introduce contradictory edges across three nested outlines.
|
|
159
|
+
for (const descendant of outlines) {
|
|
160
|
+
const descendantTarget = targetsByKey.get(descendant.key);
|
|
161
|
+
let parentId = (_b = (_a = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
162
|
+
while (parentId !== null) {
|
|
163
|
+
const ancestor = outlineBySequenceId.get(parentId);
|
|
164
|
+
if (ancestor !== undefined) {
|
|
165
|
+
addAncestorConstraint({
|
|
166
|
+
ancestor,
|
|
167
|
+
descendant,
|
|
168
|
+
descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
|
|
169
|
+
((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
|
|
170
|
+
equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
|
|
171
|
+
});
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// For unrelated overlapping outlines, put broader hit targets below
|
|
178
|
+
// smaller ones so a large selected sequence cannot swallow clicks on
|
|
179
|
+
// a more specific element in the same canvas area.
|
|
180
|
+
for (let i = 0; i < outlines.length; i++) {
|
|
181
|
+
for (let j = i + 1; j < outlines.length; j++) {
|
|
182
|
+
const a = outlines[i];
|
|
183
|
+
const b = outlines[j];
|
|
184
|
+
const aTarget = targetsByKey.get(a.key);
|
|
185
|
+
const bTarget = targetsByKey.get(b.key);
|
|
186
|
+
if (aTarget === undefined || bTarget === undefined) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const aAncestorOfB = isAncestorTarget({
|
|
190
|
+
ancestor: aTarget,
|
|
191
|
+
descendant: bTarget,
|
|
192
|
+
parentBySequenceId,
|
|
193
|
+
});
|
|
194
|
+
const bAncestorOfA = isAncestorTarget({
|
|
195
|
+
ancestor: bTarget,
|
|
196
|
+
descendant: aTarget,
|
|
197
|
+
parentBySequenceId,
|
|
198
|
+
});
|
|
199
|
+
if (aAncestorOfB || bAncestorOfA || !outlineBoundsOverlap(a, b)) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const aArea = getOutlineHitArea(a);
|
|
203
|
+
const bArea = getOutlineHitArea(b);
|
|
204
|
+
if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (aArea > bArea) {
|
|
208
|
+
addEdge(a, b, { skipIfCycle: true });
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
addEdge(b, a, { skipIfCycle: true });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const emitted = new Set();
|
|
216
|
+
const visiting = new Set();
|
|
217
|
+
const ordered = [];
|
|
218
|
+
const visit = (outline) => {
|
|
219
|
+
var _a;
|
|
220
|
+
if (emitted.has(outline.key)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (visiting.has(outline.key)) {
|
|
224
|
+
throw new Error('Could not determine a stable outline rendering order');
|
|
225
|
+
}
|
|
226
|
+
visiting.add(outline.key);
|
|
227
|
+
for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
|
|
228
|
+
const dependency = outlinesByKey.get(dependencyKey);
|
|
229
|
+
if (dependency === undefined) {
|
|
230
|
+
throw new Error('Expected outline dependency to exist');
|
|
231
|
+
}
|
|
232
|
+
visit(dependency);
|
|
233
|
+
}
|
|
234
|
+
visiting.delete(outline.key);
|
|
235
|
+
emitted.add(outline.key);
|
|
236
|
+
ordered.push(outline);
|
|
237
|
+
};
|
|
238
|
+
for (const outline of outlines) {
|
|
239
|
+
visit(outline);
|
|
240
|
+
}
|
|
241
|
+
return ordered;
|
|
242
|
+
};
|
|
243
|
+
const orderOutlinesForRendering = ({ outlines, sequences, targetsByKey, }) => {
|
|
244
|
+
const parentBySequenceId = getParentBySequenceId({ sequences, targetsByKey });
|
|
245
|
+
return orderOutlineGroup({
|
|
246
|
+
outlines,
|
|
247
|
+
parentBySequenceId,
|
|
248
|
+
targetsByKey,
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
exports.orderOutlinesForRendering = orderOutlinesForRendering;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatus, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, InteractivitySchema, InteractivitySchemaField, SequencePropsSubscriptionKey, TSequence } from 'remotion';
|
|
2
2
|
import type { SequenceNodePathInfo } from '../helpers/get-timeline-sequence-sort-key';
|
|
3
3
|
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
4
|
-
import type { SelectedOutlineUvHandle } from './selected-outline-uv';
|
|
5
4
|
import type { TimelineSelection } from './Timeline/TimelineSelection';
|
|
6
5
|
export type SelectedOutlineContextMenuOpenResult = false | readonly ComboboxValue[];
|
|
7
6
|
export type SelectedOutlineContextMenuOpenHandler = () => SelectedOutlineContextMenuOpenResult | Promise<SelectedOutlineContextMenuOpenResult>;
|
|
8
|
-
export type
|
|
7
|
+
export type SelectedOutlineLayoutTarget = {
|
|
9
8
|
readonly key: string;
|
|
10
|
-
readonly canCrop: boolean;
|
|
11
9
|
readonly containsSelection: boolean;
|
|
12
|
-
readonly
|
|
10
|
+
readonly keyframeDisplayOffset: number;
|
|
13
11
|
readonly nodePathInfo: SequenceNodePathInfo;
|
|
14
12
|
readonly ref: React.RefObject<Element | null>;
|
|
15
13
|
readonly selected: boolean;
|
|
14
|
+
readonly selectedForCrop: boolean;
|
|
15
|
+
readonly selectedForRotation: boolean;
|
|
16
|
+
readonly selectedForTransformOrigin: boolean;
|
|
17
|
+
readonly selectedForUvHandles: boolean;
|
|
18
|
+
readonly showSelectedOutline: boolean;
|
|
19
|
+
readonly transformOriginValue: string;
|
|
16
20
|
readonly selection: TimelineSelection;
|
|
17
21
|
readonly sequence: TSequence;
|
|
18
22
|
readonly crop: {
|
|
@@ -21,12 +25,14 @@ export type SelectedOutlineTarget = {
|
|
|
21
25
|
readonly top: number;
|
|
22
26
|
readonly bottom: number;
|
|
23
27
|
};
|
|
28
|
+
};
|
|
29
|
+
export type SelectedOutlineTarget = SelectedOutlineLayoutTarget & {
|
|
30
|
+
readonly canCrop: boolean;
|
|
24
31
|
readonly cropDrag: SelectedOutlineCropDragTarget | null;
|
|
25
32
|
readonly drag: SelectedOutlineDragTarget | null;
|
|
26
33
|
readonly scaleDrag: SelectedOutlineScaleDragTarget | null;
|
|
27
34
|
readonly rotationDrag: SelectedOutlineRotationDragTarget | null;
|
|
28
35
|
readonly transformOriginDrag: SelectedOutlineTransformOriginDragTarget | null;
|
|
29
|
-
readonly uvHandles: readonly SelectedOutlineUvHandle[];
|
|
30
36
|
};
|
|
31
37
|
export declare const cropFieldKeys: {
|
|
32
38
|
readonly left: "cropLeft";
|
|
@@ -62,11 +68,6 @@ export type SelectedOutlineCropDragTarget = {
|
|
|
62
68
|
readonly value: string;
|
|
63
69
|
} | null;
|
|
64
70
|
};
|
|
65
|
-
export type SelectedOutlineEffectDropTarget = {
|
|
66
|
-
readonly clientId: string;
|
|
67
|
-
readonly fileName: string;
|
|
68
|
-
readonly nodePath: SequencePropsSubscriptionKey;
|
|
69
|
-
};
|
|
70
71
|
export type SelectedOutlineDragTarget = {
|
|
71
72
|
readonly propStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
72
73
|
readonly clientId: string;
|
|
@@ -114,6 +115,7 @@ export type SelectedOutlineRotationDragTarget = {
|
|
|
114
115
|
readonly keyframeDisplayOffset: number;
|
|
115
116
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
116
117
|
readonly schema: InteractivitySchema;
|
|
118
|
+
readonly transform3DMode: boolean;
|
|
117
119
|
readonly transformOriginValue: string;
|
|
118
120
|
};
|
|
119
121
|
export type SelectedOutlineDragState = {
|
|
@@ -122,6 +124,7 @@ export type SelectedOutlineDragState = {
|
|
|
122
124
|
readonly sourceFrame: number;
|
|
123
125
|
readonly startX: number;
|
|
124
126
|
readonly startY: number;
|
|
127
|
+
readonly startZ: number | null;
|
|
125
128
|
readonly target: SelectedOutlineDragTarget;
|
|
126
129
|
};
|
|
127
130
|
export type SelectedOutlineScaleDragState = {
|
|
@@ -138,6 +141,8 @@ export type SelectedOutlineRotationDragState = {
|
|
|
138
141
|
readonly key: string;
|
|
139
142
|
readonly sourceFrame: number;
|
|
140
143
|
readonly startDegrees: number;
|
|
144
|
+
readonly startRotation: readonly [number, number, number];
|
|
145
|
+
readonly startValue: string;
|
|
141
146
|
readonly target: SelectedOutlineRotationDragTarget;
|
|
142
147
|
};
|
|
143
148
|
export type SequenceWithSelectedOutline = {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.svgPointToClientPoint = void 0;
|
|
4
|
+
const svgPointToClientPoint = (point, rect) => {
|
|
5
|
+
return {
|
|
6
|
+
x: point.x + rect.left,
|
|
7
|
+
y: point.y + rect.top,
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
exports.svgPointToClientPoint = svgPointToClientPoint;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConfigUpdate } from '@remotion/studio-shared';
|
|
2
|
+
export declare const useAutoSaveConfig: ({ enabled, onError, ready, syncRevision, updates, }: {
|
|
3
|
+
readonly enabled: boolean;
|
|
4
|
+
readonly onError: (error: string | null) => void;
|
|
5
|
+
readonly ready: boolean;
|
|
6
|
+
readonly syncRevision: number;
|
|
7
|
+
readonly updates: ConfigUpdate[];
|
|
8
|
+
}) => void;
|