@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
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SelectedOutlineOverlay = exports.
|
|
36
|
+
exports.SelectedOutlineOverlay = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getSelectedCropInfo = exports.getOutlineSelectionInteraction = exports.snapSelectedOutlineUv = exports.snapSelectedOutlineTransformOriginUv = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineUvSnapThresholdPx = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineTransformOriginLockedAxis = exports.getSelectedOutlineTransformOriginDragChanges = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineCropFollowingTransformOrigin = exports.getSelectedOutlineCropDragValues = exports.getSelectedOutlineCropDragChanges = exports.getSelectedOutlineActiveSchema = exports.getSelectedOutline3DRotationDragValues = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineTransformOriginAxisLock = exports.applySelectedOutlineDragAxisLock = exports.orderOutlinesForRendering = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const player_1 = require("@remotion/player");
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
@@ -41,30 +41,27 @@ const remotion_1 = require("remotion");
|
|
|
41
41
|
const no_react_1 = require("remotion/no-react");
|
|
42
42
|
const client_id_1 = require("../helpers/client-id");
|
|
43
43
|
const interactivity_enabled_1 = require("../helpers/interactivity-enabled");
|
|
44
|
+
const timeline_node_path_key_1 = require("../helpers/timeline-node-path-key");
|
|
44
45
|
const use_is_fullscreen_1 = require("../helpers/use-is-fullscreen");
|
|
45
|
-
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
46
46
|
const use_runtime_values_1 = require("../helpers/use-runtime-values");
|
|
47
|
-
const editor_guides_1 = require("../state/editor-guides");
|
|
48
47
|
const editor_outlines_1 = require("../state/editor-outlines");
|
|
49
48
|
const scale_lock_1 = require("../state/scale-lock");
|
|
50
49
|
const timeline_sequence_hover_1 = require("../state/timeline-sequence-hover");
|
|
51
|
-
const
|
|
50
|
+
const transform_3d_mode_1 = require("../state/transform-3d-mode");
|
|
52
51
|
const selected_outline_drag_1 = require("./selected-outline-drag");
|
|
53
52
|
const selected_outline_measurement_1 = require("./selected-outline-measurement");
|
|
54
|
-
const
|
|
53
|
+
const selected_outline_order_1 = require("./selected-outline-order");
|
|
54
|
+
Object.defineProperty(exports, "orderOutlinesForRendering", { enumerable: true, get: function () { return selected_outline_order_1.orderOutlinesForRendering; } });
|
|
55
55
|
const selected_outline_types_1 = require("./selected-outline-types");
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const SelectedOutlineUvControls_1 = require("./SelectedOutlineUvControls");
|
|
59
|
-
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
60
|
-
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
61
|
-
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
62
|
-
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
56
|
+
const SelectedOutlineKeyboardControls_1 = require("./SelectedOutlineKeyboardControls");
|
|
57
|
+
const SelectedOutlineRenderer_1 = require("./SelectedOutlineRenderer");
|
|
63
58
|
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
59
|
+
const transform_3d_mode_2 = require("./Timeline/transform-3d-mode");
|
|
64
60
|
const selected_outline_drag_2 = require("./selected-outline-drag");
|
|
65
61
|
Object.defineProperty(exports, "applySelectedOutlineDragAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineDragAxisLock; } });
|
|
66
62
|
Object.defineProperty(exports, "applySelectedOutlineTransformOriginAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineTransformOriginAxisLock; } });
|
|
67
63
|
Object.defineProperty(exports, "compensateTranslateForTransformOrigin", { enumerable: true, get: function () { return selected_outline_drag_2.compensateTranslateForTransformOrigin; } });
|
|
64
|
+
Object.defineProperty(exports, "getSelectedOutline3DRotationDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutline3DRotationDragValues; } });
|
|
68
65
|
Object.defineProperty(exports, "getSelectedOutlineActiveSchema", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineActiveSchema; } });
|
|
69
66
|
Object.defineProperty(exports, "getSelectedOutlineCropDragChanges", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineCropDragChanges; } });
|
|
70
67
|
Object.defineProperty(exports, "getSelectedOutlineCropDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineCropDragValues; } });
|
|
@@ -144,518 +141,210 @@ const getCropDragFields = ({ activeSchema, cropValues, propStatuses, }) => {
|
|
|
144
141
|
}
|
|
145
142
|
return fields;
|
|
146
143
|
};
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const SelectedOutlineSnapIndicators = ({ activeSnapPoints, compositionHeight, compositionWidth, scale }) => {
|
|
154
|
-
if (activeSnapPoints.length === 0) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
return (jsx_runtime_1.jsx("g", { pointerEvents: "none", children: activeSnapPoints.map((snapPoint) => {
|
|
158
|
-
if (snapPoint.target.axis === 'x') {
|
|
159
|
-
const x = snapPoint.target.position * scale;
|
|
160
|
-
return (jsx_runtime_1.jsx("line", { x1: x, x2: x, y1: 0, y2: compositionHeight * scale, stroke: selected_outline_snap_1.selectedOutlineSnapIndicatorColor, strokeWidth: 1, vectorEffect: "non-scaling-stroke" }, `${snapPoint.target.axis}-${snapPoint.target.type}-${snapPoint.target.position}-${snapPoint.edge}`));
|
|
161
|
-
}
|
|
162
|
-
const y = snapPoint.target.position * scale;
|
|
163
|
-
return (jsx_runtime_1.jsx("line", { x1: 0, x2: compositionWidth * scale, y1: y, y2: y, stroke: selected_outline_snap_1.selectedOutlineSnapIndicatorColor, strokeWidth: 1, vectorEffect: "non-scaling-stroke" }, `${snapPoint.target.axis}-${snapPoint.target.type}-${snapPoint.target.position}-${snapPoint.edge}`));
|
|
164
|
-
}) }));
|
|
165
|
-
};
|
|
166
|
-
const outlinePointEqualityTolerance = 0.5;
|
|
167
|
-
const outlineAreaEqualityTolerance = 0.5;
|
|
168
|
-
const outlineBoundsOverlapTolerance = 0.5;
|
|
169
|
-
const outlinePointsAreEquivalent = (a, b) => {
|
|
170
|
-
return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
|
|
171
|
-
Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
|
|
172
|
-
};
|
|
173
|
-
const outlinesHaveEquivalentHitArea = (a, b) => {
|
|
174
|
-
if (a.points.length !== b.points.length) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
|
|
178
|
-
for (const direction of [1, -1]) {
|
|
179
|
-
const pointsMatch = a.points.every((point, index) => {
|
|
180
|
-
const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
|
|
181
|
-
return outlinePointsAreEquivalent(point, b.points[bIndex]);
|
|
182
|
-
});
|
|
183
|
-
if (pointsMatch) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return false;
|
|
189
|
-
};
|
|
190
|
-
const getOutlineHitArea = (outline) => {
|
|
191
|
-
let area = 0;
|
|
192
|
-
for (let i = 0; i < outline.points.length; i++) {
|
|
193
|
-
const current = outline.points[i];
|
|
194
|
-
const next = outline.points[(i + 1) % outline.points.length];
|
|
195
|
-
area += current.x * next.y - next.x * current.y;
|
|
196
|
-
}
|
|
197
|
-
return Math.abs(area) / 2;
|
|
198
|
-
};
|
|
199
|
-
const getOutlineBounds = (outline) => {
|
|
200
|
-
const xs = outline.points.map((point) => point.x);
|
|
201
|
-
const ys = outline.points.map((point) => point.y);
|
|
202
|
-
return {
|
|
203
|
-
maxX: Math.max(...xs),
|
|
204
|
-
maxY: Math.max(...ys),
|
|
205
|
-
minX: Math.min(...xs),
|
|
206
|
-
minY: Math.min(...ys),
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
const outlineBoundsOverlap = (a, b) => {
|
|
210
|
-
const aBounds = getOutlineBounds(a);
|
|
211
|
-
const bBounds = getOutlineBounds(b);
|
|
212
|
-
return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
|
|
213
|
-
aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
|
|
214
|
-
aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
|
|
215
|
-
aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
|
|
216
|
-
};
|
|
217
|
-
const getSequenceId = (target) => {
|
|
218
|
-
var _a;
|
|
219
|
-
var _b;
|
|
220
|
-
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;
|
|
221
|
-
};
|
|
222
|
-
const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
|
|
223
|
-
const parentBySequenceId = new Map();
|
|
224
|
-
for (const sequence of sequences) {
|
|
225
|
-
parentBySequenceId.set(sequence.id, sequence.parent);
|
|
226
|
-
}
|
|
227
|
-
for (const target of targetsByKey.values()) {
|
|
228
|
-
const sequenceId = getSequenceId(target);
|
|
229
|
-
if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
|
|
230
|
-
parentBySequenceId.set(sequenceId, target.sequence.parent);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return parentBySequenceId;
|
|
234
|
-
};
|
|
235
|
-
const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
|
|
236
|
-
var _a;
|
|
237
|
-
var _b, _c;
|
|
238
|
-
const ancestorId = getSequenceId(ancestor);
|
|
239
|
-
if (ancestorId === null) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
243
|
-
while (parentId !== null) {
|
|
244
|
-
if (parentId === ancestorId) {
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
|
|
248
|
-
}
|
|
249
|
-
return false;
|
|
250
|
-
};
|
|
251
|
-
const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
|
|
252
|
-
var _a;
|
|
253
|
-
var _b, _c, _d, _e;
|
|
254
|
-
const incomingEdges = new Map();
|
|
255
|
-
const outgoingEdges = new Map();
|
|
256
|
-
const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
|
|
257
|
-
for (const outline of outlines) {
|
|
258
|
-
incomingEdges.set(outline.key, new Set());
|
|
259
|
-
outgoingEdges.set(outline.key, new Set());
|
|
260
|
-
}
|
|
261
|
-
const hasPath = ({ fromKey, seen, toKey, }) => {
|
|
262
|
-
var _a;
|
|
263
|
-
if (fromKey === toKey) {
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
if (seen.has(fromKey)) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
seen.add(fromKey);
|
|
270
|
-
for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
|
|
271
|
-
if (hasPath({ fromKey: nextKey, seen, toKey })) {
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
|
-
};
|
|
277
|
-
const addEdge = (before, after, options) => {
|
|
278
|
-
if (before.key === after.key) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const incoming = incomingEdges.get(after.key);
|
|
282
|
-
const outgoing = outgoingEdges.get(before.key);
|
|
283
|
-
if (incoming === undefined || outgoing === undefined) {
|
|
284
|
-
throw new Error('Expected outline to be registered before adding edge');
|
|
285
|
-
}
|
|
286
|
-
if (outgoing.has(after.key)) {
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
|
|
290
|
-
if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
294
|
-
}
|
|
295
|
-
incoming.add(before.key);
|
|
296
|
-
outgoing.add(after.key);
|
|
297
|
-
};
|
|
298
|
-
const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
|
|
299
|
-
// Usually, children should be above parents so nested elements are directly
|
|
300
|
-
// selectable. If an unselected child has the same hit area as its parent, put
|
|
301
|
-
// it below the parent so the wrapper can be selected. Once the child or
|
|
302
|
-
// one of its properties is selected, keep it above the parent so it remains
|
|
303
|
-
// directly draggable.
|
|
304
|
-
if (equivalentHitArea && !descendantContainsSelection) {
|
|
305
|
-
addEdge(descendant, ancestor);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
addEdge(ancestor, descendant);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
const outlineBySequenceId = new Map();
|
|
312
|
-
for (const outline of outlines) {
|
|
313
|
-
const sequenceId = getSequenceId(targetsByKey.get(outline.key));
|
|
314
|
-
if (sequenceId !== null) {
|
|
315
|
-
outlineBySequenceId.set(sequenceId, outline);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
// Only constrain each outline against its nearest rendered ancestor. The
|
|
319
|
-
// resulting graph follows the sequence tree, so pairwise subpixel equivalence
|
|
320
|
-
// cannot introduce contradictory edges across three nested outlines.
|
|
321
|
-
for (const descendant of outlines) {
|
|
322
|
-
const descendantTarget = targetsByKey.get(descendant.key);
|
|
323
|
-
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;
|
|
324
|
-
while (parentId !== null) {
|
|
325
|
-
const ancestor = outlineBySequenceId.get(parentId);
|
|
326
|
-
if (ancestor !== undefined) {
|
|
327
|
-
addAncestorConstraint({
|
|
328
|
-
ancestor,
|
|
329
|
-
descendant,
|
|
330
|
-
descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
|
|
331
|
-
((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
|
|
332
|
-
equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
|
|
333
|
-
});
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
// For unrelated overlapping outlines, put broader hit targets below
|
|
340
|
-
// smaller ones so a large selected sequence cannot swallow clicks on
|
|
341
|
-
// a more specific element in the same canvas area.
|
|
342
|
-
for (let i = 0; i < outlines.length; i++) {
|
|
343
|
-
for (let j = i + 1; j < outlines.length; j++) {
|
|
344
|
-
const a = outlines[i];
|
|
345
|
-
const b = outlines[j];
|
|
346
|
-
const aTarget = targetsByKey.get(a.key);
|
|
347
|
-
const bTarget = targetsByKey.get(b.key);
|
|
348
|
-
if (aTarget === undefined || bTarget === undefined) {
|
|
349
|
-
continue;
|
|
350
|
-
}
|
|
351
|
-
const aAncestorOfB = isAncestorTarget({
|
|
352
|
-
ancestor: aTarget,
|
|
353
|
-
descendant: bTarget,
|
|
354
|
-
parentBySequenceId,
|
|
355
|
-
});
|
|
356
|
-
const bAncestorOfA = isAncestorTarget({
|
|
357
|
-
ancestor: bTarget,
|
|
358
|
-
descendant: aTarget,
|
|
359
|
-
parentBySequenceId,
|
|
360
|
-
});
|
|
361
|
-
if (aAncestorOfB || bAncestorOfA || !outlineBoundsOverlap(a, b)) {
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
364
|
-
const aArea = getOutlineHitArea(a);
|
|
365
|
-
const bArea = getOutlineHitArea(b);
|
|
366
|
-
if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
if (aArea > bArea) {
|
|
370
|
-
addEdge(a, b, { skipIfCycle: true });
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
addEdge(b, a, { skipIfCycle: true });
|
|
374
|
-
}
|
|
375
|
-
}
|
|
144
|
+
const calculateOutlineTargets = ({ connectedClientId, editorShowOutlines, getDragOverrides, getScaleLockState, isFullscreen, manuallyEnabled3DTransformSequenceKeys, mode, previewSelectionAvailable, propStatuses, runtimeValuesByStore, selectableOutlines, selectedCropInfo, selectedEffectsBySequenceKey, selectedRotationInfo, selectedSequenceKeys, selectedTransformOriginInfo, sequenceKeysContainingSelection, studioInteractivityEnabled, targetKey, targetTimelinePosition, }) => {
|
|
145
|
+
if (isFullscreen ||
|
|
146
|
+
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
147
|
+
!previewSelectionAvailable ||
|
|
148
|
+
!editorShowOutlines) {
|
|
149
|
+
return [];
|
|
376
150
|
}
|
|
377
|
-
const
|
|
378
|
-
const
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
if (
|
|
383
|
-
|
|
151
|
+
const previewInteractive = connectedClientId !== null && studioInteractivityEnabled;
|
|
152
|
+
const firstNodePathInfoBySourceNode = new Map();
|
|
153
|
+
const selectedSourceNodeKeys = new Set();
|
|
154
|
+
for (const { key, nodePathInfo } of selectableOutlines) {
|
|
155
|
+
const sourceNodeKey = (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(nodePathInfo.sequenceSubscriptionKey);
|
|
156
|
+
if (selectedSequenceKeys.has(key)) {
|
|
157
|
+
selectedSourceNodeKeys.add(sourceNodeKey);
|
|
158
|
+
}
|
|
159
|
+
const currentFirst = firstNodePathInfoBySourceNode.get(sourceNodeKey);
|
|
160
|
+
if (currentFirst === undefined || nodePathInfo.index < currentFirst.index) {
|
|
161
|
+
firstNodePathInfoBySourceNode.set(sourceNodeKey, nodePathInfo);
|
|
384
162
|
}
|
|
385
|
-
if (visiting.has(outline.key)) {
|
|
386
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
387
|
-
}
|
|
388
|
-
visiting.add(outline.key);
|
|
389
|
-
for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
|
|
390
|
-
const dependency = outlinesByKey.get(dependencyKey);
|
|
391
|
-
if (dependency === undefined) {
|
|
392
|
-
throw new Error('Expected outline dependency to exist');
|
|
393
|
-
}
|
|
394
|
-
visit(dependency);
|
|
395
|
-
}
|
|
396
|
-
visiting.delete(outline.key);
|
|
397
|
-
emitted.add(outline.key);
|
|
398
|
-
ordered.push(outline);
|
|
399
|
-
};
|
|
400
|
-
for (const outline of outlines) {
|
|
401
|
-
visit(outline);
|
|
402
163
|
}
|
|
403
|
-
return
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
return orderOutlineGroup({
|
|
408
|
-
outlines,
|
|
409
|
-
parentBySequenceId,
|
|
410
|
-
targetsByKey,
|
|
411
|
-
});
|
|
412
|
-
};
|
|
413
|
-
exports.orderOutlinesForRendering = orderOutlinesForRendering;
|
|
414
|
-
const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, translationX, translationY, }) => {
|
|
415
|
-
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
416
|
-
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
417
|
-
const { canvasContent, compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
418
|
-
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
419
|
-
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
420
|
-
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
421
|
-
const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
422
|
-
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
423
|
-
const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
424
|
-
const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
425
|
-
const { hoveredSequence, setHoveredSequence } = (0, react_1.useContext)(timeline_sequence_hover_1.TimelineSequenceHoverContext);
|
|
426
|
-
const { editorShowGuides, guidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
427
|
-
const isFullscreen = (0, use_is_fullscreen_1.useIsFullscreen)();
|
|
428
|
-
const { frameBack, frameForward, getCurrentFrame, seek } = player_1.PlayerInternals.usePlayerMethods();
|
|
429
|
-
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
430
|
-
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
431
|
-
const [outlines, setOutlines] = (0, react_1.useState)([]);
|
|
432
|
-
const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
|
|
433
|
-
const [activeSnapPoints, setActiveSnapPoints] = (0, react_1.useState)([]);
|
|
434
|
-
const overlayRef = (0, react_1.useRef)(null);
|
|
435
|
-
const keyboardNudgeSessionRef = (0, react_1.useRef)(null);
|
|
436
|
-
const saveKeyboardNudgeSessionRef = (0, react_1.useRef)(() => undefined);
|
|
437
|
-
const previewInteractive = previewServerState.type === 'connected' && (0, interactivity_enabled_1.isStudioInteractivityEnabled)();
|
|
438
|
-
const previewSelectionAvailable = previewServerState.type === 'connected' || window.remotion_isReadOnlyStudio;
|
|
439
|
-
const onDraggingChange = react_1.default.useCallback((dragging) => {
|
|
440
|
-
setDraggingOutline(dragging);
|
|
441
|
-
if (dragging) {
|
|
442
|
-
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
setActiveSnapPoints([]);
|
|
446
|
-
}
|
|
447
|
-
}, [setHoveredSequence]);
|
|
448
|
-
const onHoverChange = (0, react_1.useCallback)((key) => {
|
|
449
|
-
setHoveredSequence((currentHover) => {
|
|
450
|
-
if (key !== null) {
|
|
451
|
-
return { key, source: 'canvas' };
|
|
452
|
-
}
|
|
453
|
-
return (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover;
|
|
454
|
-
});
|
|
455
|
-
}, [setHoveredSequence]);
|
|
456
|
-
const onSnapPointsChange = (0, react_1.useCallback)((snapPoints) => {
|
|
457
|
-
setActiveSnapPoints(snapPoints);
|
|
458
|
-
}, []);
|
|
459
|
-
const selectOutlineItem = (0, react_1.useCallback)((item, interaction) => {
|
|
460
|
-
selectItem(item, interaction, undefined, { reveal: true });
|
|
461
|
-
}, [selectItem]);
|
|
462
|
-
const outlineRuntimeControls = (0, react_1.useMemo)(() => {
|
|
463
|
-
if (isFullscreen ||
|
|
464
|
-
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
465
|
-
!previewSelectionAvailable ||
|
|
466
|
-
!editorShowOutlines) {
|
|
164
|
+
return selectableOutlines.flatMap((selectableOutline) => {
|
|
165
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
166
|
+
const { key, keyframeDisplayOffset, nodePathInfo, sequence } = selectableOutline;
|
|
167
|
+
if (targetKey !== null && targetKey !== key) {
|
|
467
168
|
return [];
|
|
468
169
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const outlineRuntimeValuesByStore = (0, react_1.useMemo)(() => new Map(outlineRuntimeControls.map((controls, index) => [
|
|
497
|
-
controls.runtimeValues,
|
|
498
|
-
outlineRuntimeSnapshots[index],
|
|
499
|
-
])), [outlineRuntimeControls, outlineRuntimeSnapshots]);
|
|
500
|
-
const outlineTargets = (0, react_1.useMemo)(() => {
|
|
501
|
-
if (isFullscreen ||
|
|
502
|
-
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
503
|
-
!previewSelectionAvailable ||
|
|
504
|
-
!editorShowOutlines) {
|
|
505
|
-
return [];
|
|
506
|
-
}
|
|
507
|
-
const selectedSequenceKeys = (0, selected_outline_measurement_1.getSelectedSequenceKeys)(selectedItems);
|
|
508
|
-
const sequenceKeysContainingSelection = (0, selected_outline_measurement_1.getSequenceKeysContainingSelection)(selectedItems);
|
|
509
|
-
const selectedEffectsBySequenceKey = (0, selected_outline_measurement_1.getSelectedEffectFieldsBySequenceKey)(selectedItems);
|
|
510
|
-
const selectedTransformOriginInfo = (0, selected_outline_measurement_1.getSelectedTransformOriginInfo)(selectedItems);
|
|
511
|
-
const selectedCropInfo = (0, selected_outline_measurement_1.getSelectedCropInfo)(selectedItems);
|
|
512
|
-
const clientId = previewServerState.type === 'connected'
|
|
513
|
-
? previewServerState.clientId
|
|
170
|
+
if (sequence.refForOutline === null) {
|
|
171
|
+
throw new Error('Expected sequence to have a ref for outline');
|
|
172
|
+
}
|
|
173
|
+
const selected = selectedSequenceKeys.has(key);
|
|
174
|
+
const containsSelection = sequenceKeysContainingSelection.has(key);
|
|
175
|
+
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
176
|
+
const sourceNodeKey = (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(nodePath);
|
|
177
|
+
const showSelectedOutline = containsSelection || selectedSourceNodeKeys.has(sourceNodeKey);
|
|
178
|
+
const selectionNodePathInfo = firstNodePathInfoBySourceNode.get(sourceNodeKey);
|
|
179
|
+
if (selectionNodePathInfo === undefined) {
|
|
180
|
+
throw new Error('Expected a first sequence for the source node');
|
|
181
|
+
}
|
|
182
|
+
const { controls } = sequence;
|
|
183
|
+
const nodePropStatuses = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath);
|
|
184
|
+
const sourceFrame = targetTimelinePosition - keyframeDisplayOffset;
|
|
185
|
+
const dragOverrides = (_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {};
|
|
186
|
+
const runtimeValues = controls
|
|
187
|
+
? ((_b = runtimeValuesByStore.get(controls.runtimeValues)) !== null && _b !== void 0 ? _b : controls.runtimeValues.getSnapshot())
|
|
188
|
+
: {};
|
|
189
|
+
const activeSchema = controls
|
|
190
|
+
? (0, selected_outline_drag_1.getSelectedOutlineActiveSchema)({
|
|
191
|
+
schema: controls.schema,
|
|
192
|
+
currentRuntimeValueDotNotation: runtimeValues,
|
|
193
|
+
dragOverrides,
|
|
194
|
+
propStatus: nodePropStatuses,
|
|
195
|
+
frame: sourceFrame,
|
|
196
|
+
})
|
|
514
197
|
: null;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
518
|
-
compositions,
|
|
519
|
-
timelinePosition,
|
|
520
|
-
}).map(({ key, keyframeDisplayOffset, nodePathInfo, sequence }) => {
|
|
521
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
522
|
-
if (sequence.refForOutline === null) {
|
|
523
|
-
throw new Error('Expected sequence to have a ref for outline');
|
|
524
|
-
}
|
|
525
|
-
const selected = selectedSequenceKeys.has(key);
|
|
526
|
-
const containsSelection = sequenceKeysContainingSelection.has(key);
|
|
527
|
-
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
528
|
-
const { controls } = sequence;
|
|
529
|
-
const nodePropStatuses = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath);
|
|
530
|
-
const sourceFrame = timelinePosition - keyframeDisplayOffset;
|
|
531
|
-
const dragOverrides = (_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {};
|
|
532
|
-
const runtimeValues = controls
|
|
533
|
-
? ((_b = outlineRuntimeValuesByStore.get(controls.runtimeValues)) !== null && _b !== void 0 ? _b : controls.runtimeValues.getSnapshot())
|
|
534
|
-
: {};
|
|
535
|
-
const activeSchema = controls
|
|
536
|
-
? (0, selected_outline_drag_1.getSelectedOutlineActiveSchema)({
|
|
537
|
-
schema: controls.schema,
|
|
538
|
-
currentRuntimeValueDotNotation: runtimeValues,
|
|
539
|
-
dragOverrides,
|
|
540
|
-
propStatus: nodePropStatuses,
|
|
541
|
-
frame: sourceFrame,
|
|
542
|
-
})
|
|
543
|
-
: null;
|
|
544
|
-
const cropValues = {
|
|
545
|
-
cropLeft: getEffectiveCropValue({
|
|
546
|
-
activeSchema,
|
|
547
|
-
dragOverrides,
|
|
548
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.left,
|
|
549
|
-
frame: sourceFrame,
|
|
550
|
-
propStatuses: nodePropStatuses,
|
|
551
|
-
runtimeValues,
|
|
552
|
-
}),
|
|
553
|
-
cropRight: getEffectiveCropValue({
|
|
554
|
-
activeSchema,
|
|
555
|
-
dragOverrides,
|
|
556
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.right,
|
|
557
|
-
frame: sourceFrame,
|
|
558
|
-
propStatuses: nodePropStatuses,
|
|
559
|
-
runtimeValues,
|
|
560
|
-
}),
|
|
561
|
-
cropTop: getEffectiveCropValue({
|
|
562
|
-
activeSchema,
|
|
563
|
-
dragOverrides,
|
|
564
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.top,
|
|
565
|
-
frame: sourceFrame,
|
|
566
|
-
propStatuses: nodePropStatuses,
|
|
567
|
-
runtimeValues,
|
|
568
|
-
}),
|
|
569
|
-
cropBottom: getEffectiveCropValue({
|
|
570
|
-
activeSchema,
|
|
571
|
-
dragOverrides,
|
|
572
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.bottom,
|
|
573
|
-
frame: sourceFrame,
|
|
574
|
-
propStatuses: nodePropStatuses,
|
|
575
|
-
runtimeValues,
|
|
576
|
-
}),
|
|
577
|
-
};
|
|
578
|
-
const crop = remotion_1.Internals.resolveSequenceCrop(cropValues);
|
|
579
|
-
const cropFields = getCropDragFields({
|
|
198
|
+
const cropValues = {
|
|
199
|
+
cropLeft: getEffectiveCropValue({
|
|
580
200
|
activeSchema,
|
|
581
|
-
|
|
201
|
+
dragOverrides,
|
|
202
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.left,
|
|
203
|
+
frame: sourceFrame,
|
|
582
204
|
propStatuses: nodePropStatuses,
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
205
|
+
runtimeValues,
|
|
206
|
+
}),
|
|
207
|
+
cropRight: getEffectiveCropValue({
|
|
208
|
+
activeSchema,
|
|
209
|
+
dragOverrides,
|
|
210
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.right,
|
|
211
|
+
frame: sourceFrame,
|
|
212
|
+
propStatuses: nodePropStatuses,
|
|
213
|
+
runtimeValues,
|
|
214
|
+
}),
|
|
215
|
+
cropTop: getEffectiveCropValue({
|
|
216
|
+
activeSchema,
|
|
217
|
+
dragOverrides,
|
|
218
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.top,
|
|
219
|
+
frame: sourceFrame,
|
|
220
|
+
propStatuses: nodePropStatuses,
|
|
221
|
+
runtimeValues,
|
|
222
|
+
}),
|
|
223
|
+
cropBottom: getEffectiveCropValue({
|
|
224
|
+
activeSchema,
|
|
225
|
+
dragOverrides,
|
|
226
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.bottom,
|
|
227
|
+
frame: sourceFrame,
|
|
228
|
+
propStatuses: nodePropStatuses,
|
|
229
|
+
runtimeValues,
|
|
230
|
+
}),
|
|
231
|
+
};
|
|
232
|
+
const crop = remotion_1.Internals.resolveSequenceCrop(cropValues);
|
|
233
|
+
const selectedForTransformOrigin = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.sequenceKey) === key;
|
|
234
|
+
const selectedForCrop = (selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.sequenceKey) === key;
|
|
235
|
+
const selectedForRotation = (selectedRotationInfo === null || selectedRotationInfo === void 0 ? void 0 : selectedRotationInfo.sequenceKey) === key;
|
|
236
|
+
const selectedForUvHandles = selectedEffectsBySequenceKey.has(key);
|
|
237
|
+
const fieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.translateFieldKey];
|
|
238
|
+
const propStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.translateFieldKey];
|
|
239
|
+
const scaleFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.scaleFieldKey];
|
|
240
|
+
const scalePropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.scaleFieldKey];
|
|
241
|
+
const rotationFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.rotateFieldKey];
|
|
242
|
+
const rotationPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.rotateFieldKey];
|
|
243
|
+
const transformOriginFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.transformOriginFieldKey];
|
|
244
|
+
const transformOriginPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.transformOriginFieldKey];
|
|
245
|
+
const transformOriginValueForRotation = (transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
246
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
247
|
+
(transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed')
|
|
248
|
+
? String((_c = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
249
|
+
propStatus: transformOriginPropStatus,
|
|
250
|
+
dragOverrideValue: dragOverrides[selected_outline_types_1.transformOriginFieldKey],
|
|
251
|
+
defaultValue: transformOriginFieldSchema.default,
|
|
252
|
+
frame: sourceFrame,
|
|
253
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
254
|
+
})) !== null && _c !== void 0 ? _c : transformOriginFieldSchema.default)
|
|
255
|
+
: '50% 50%';
|
|
256
|
+
const layoutTarget = {
|
|
257
|
+
key,
|
|
258
|
+
containsSelection,
|
|
259
|
+
crop,
|
|
260
|
+
keyframeDisplayOffset,
|
|
261
|
+
nodePathInfo,
|
|
262
|
+
ref: sequence.refForOutline,
|
|
263
|
+
selected,
|
|
264
|
+
selectedForCrop,
|
|
265
|
+
selectedForRotation,
|
|
266
|
+
selectedForTransformOrigin,
|
|
267
|
+
selectedForUvHandles,
|
|
268
|
+
showSelectedOutline,
|
|
269
|
+
transformOriginValue: transformOriginValueForRotation,
|
|
270
|
+
selection: {
|
|
271
|
+
type: 'sequence',
|
|
272
|
+
nodePathInfo: selectionNodePathInfo,
|
|
273
|
+
},
|
|
274
|
+
sequence,
|
|
275
|
+
};
|
|
276
|
+
if (mode === 'layout') {
|
|
277
|
+
return [layoutTarget];
|
|
278
|
+
}
|
|
279
|
+
const cropFields = getCropDragFields({
|
|
280
|
+
activeSchema,
|
|
281
|
+
cropValues,
|
|
282
|
+
propStatuses: nodePropStatuses,
|
|
283
|
+
});
|
|
284
|
+
const canDragStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
285
|
+
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
286
|
+
propStatus.interpolationFunction === 'interpolate');
|
|
287
|
+
const canRotationDragStatus = (rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'static' ||
|
|
288
|
+
((rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed' &&
|
|
289
|
+
rotationPropStatus.interpolationFunction === 'interpolate');
|
|
290
|
+
const canDrag = previewInteractive &&
|
|
291
|
+
controls !== null &&
|
|
292
|
+
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
293
|
+
canDragStatus;
|
|
294
|
+
const canScaleDragStatus = (scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'static' ||
|
|
295
|
+
((scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed' &&
|
|
296
|
+
scalePropStatus.interpolationFunction === 'interpolate');
|
|
297
|
+
const canScaleDrag = previewInteractive &&
|
|
298
|
+
controls !== null &&
|
|
299
|
+
(scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale' &&
|
|
300
|
+
canScaleDragStatus;
|
|
301
|
+
const canRotationDrag = previewInteractive &&
|
|
302
|
+
controls !== null &&
|
|
303
|
+
(rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css' &&
|
|
304
|
+
canRotationDragStatus;
|
|
305
|
+
const transform3DMode = manuallyEnabled3DTransformSequenceKeys.has(key) ||
|
|
306
|
+
[
|
|
307
|
+
'style.translate',
|
|
308
|
+
'style.scale',
|
|
309
|
+
'style.rotate',
|
|
310
|
+
'style.transformOrigin',
|
|
311
|
+
].some((fieldKey) => (0, transform_3d_mode_2.propStatusHas3DTransformValue)({
|
|
312
|
+
fieldKey,
|
|
313
|
+
propStatus: nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[fieldKey],
|
|
314
|
+
runtimeValue: runtimeValues[fieldKey],
|
|
315
|
+
}));
|
|
316
|
+
const transformOriginSourceFrame = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === null ||
|
|
317
|
+
(selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === undefined
|
|
318
|
+
? sourceFrame
|
|
319
|
+
: selectedTransformOriginInfo.displayFrame - keyframeDisplayOffset;
|
|
320
|
+
const canTransformOriginStatus = (transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
321
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed' &&
|
|
322
|
+
transformOriginPropStatus.interpolationFunction === 'interpolate');
|
|
323
|
+
const canTransformOriginTranslateStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
324
|
+
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
325
|
+
propStatus.interpolationFunction === 'interpolate');
|
|
326
|
+
const canTransformOriginDrag = previewInteractive &&
|
|
327
|
+
(selectedForTransformOrigin || selectedForRotation) &&
|
|
328
|
+
controls !== null &&
|
|
329
|
+
(transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
330
|
+
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
331
|
+
canTransformOriginStatus &&
|
|
332
|
+
canTransformOriginTranslateStatus;
|
|
333
|
+
const cropSourceFrame = (selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.displayFrame) === null ||
|
|
334
|
+
(selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.displayFrame) === undefined
|
|
335
|
+
? sourceFrame
|
|
336
|
+
: selectedCropInfo.displayFrame - keyframeDisplayOffset;
|
|
337
|
+
const canCropDrag = previewInteractive &&
|
|
338
|
+
selectedForCrop &&
|
|
339
|
+
controls !== null &&
|
|
340
|
+
cropFields !== null;
|
|
341
|
+
return [
|
|
342
|
+
{
|
|
343
|
+
...layoutTarget,
|
|
654
344
|
canCrop: previewInteractive && controls !== null && cropFields !== null,
|
|
655
|
-
crop,
|
|
656
345
|
cropDrag: canCropDrag
|
|
657
346
|
? {
|
|
658
|
-
clientId:
|
|
347
|
+
clientId: connectedClientId,
|
|
659
348
|
fields: cropFields,
|
|
660
349
|
nodePath,
|
|
661
350
|
schema: controls.schema,
|
|
@@ -670,23 +359,10 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
670
359
|
: null,
|
|
671
360
|
}
|
|
672
361
|
: null,
|
|
673
|
-
containsSelection,
|
|
674
|
-
effectDrop: canDropEffect
|
|
675
|
-
? {
|
|
676
|
-
clientId: previewServerState.clientId,
|
|
677
|
-
fileName: nodePath.absolutePath,
|
|
678
|
-
nodePath,
|
|
679
|
-
}
|
|
680
|
-
: null,
|
|
681
|
-
nodePathInfo,
|
|
682
|
-
ref: sequence.refForOutline,
|
|
683
|
-
selected,
|
|
684
|
-
selection: { type: 'sequence', nodePathInfo },
|
|
685
|
-
sequence,
|
|
686
362
|
drag: canDrag
|
|
687
363
|
? {
|
|
688
364
|
propStatus,
|
|
689
|
-
clientId:
|
|
365
|
+
clientId: connectedClientId,
|
|
690
366
|
fieldDefault: fieldSchema.default,
|
|
691
367
|
keyframeDisplayOffset,
|
|
692
368
|
nodePath,
|
|
@@ -696,7 +372,7 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
696
372
|
scaleDrag: canScaleDrag
|
|
697
373
|
? {
|
|
698
374
|
propStatus: scalePropStatus,
|
|
699
|
-
clientId:
|
|
375
|
+
clientId: connectedClientId,
|
|
700
376
|
fieldDefault: scaleFieldSchema.default,
|
|
701
377
|
fieldSchema: scaleFieldSchema,
|
|
702
378
|
keyframeDisplayOffset,
|
|
@@ -722,18 +398,19 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
722
398
|
rotationDrag: canRotationDrag
|
|
723
399
|
? {
|
|
724
400
|
propStatus: rotationPropStatus,
|
|
725
|
-
clientId:
|
|
401
|
+
clientId: connectedClientId,
|
|
726
402
|
fieldDefault: rotationFieldSchema.default,
|
|
727
403
|
fieldSchema: rotationFieldSchema,
|
|
728
404
|
keyframeDisplayOffset,
|
|
729
405
|
nodePath,
|
|
730
406
|
schema: controls.schema,
|
|
407
|
+
transform3DMode,
|
|
731
408
|
transformOriginValue: transformOriginValueForRotation,
|
|
732
409
|
}
|
|
733
410
|
: null,
|
|
734
411
|
transformOriginDrag: canTransformOriginDrag
|
|
735
412
|
? {
|
|
736
|
-
clientId:
|
|
413
|
+
clientId: connectedClientId,
|
|
737
414
|
keyframeDisplayOffset,
|
|
738
415
|
nodePath,
|
|
739
416
|
originDefault: transformOriginFieldSchema.default,
|
|
@@ -782,353 +459,190 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
782
459
|
})) !== null && _g !== void 0 ? _g : fieldSchema.default),
|
|
783
460
|
}
|
|
784
461
|
: null,
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
462
|
+
},
|
|
463
|
+
];
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
const ActiveSelectedOutlineOverlayUnmemoized = ({ calculateOutlineTargetsForCurrentState, compositionHeight, compositionWidth, draggingOutline, getLatestOutlineTargetByKey, getSelectableOutlines, onDraggingChange, onContextMenuOpenChange, onSelect, scale, selectedSequenceKeys, sequenceKeysContainingSelection, sequences, translationX, translationY, }) => {
|
|
467
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
468
|
+
const updateOutlinesRef = (0, react_1.useRef)(() => undefined);
|
|
469
|
+
const selectableOutlines = (0, react_1.useMemo)(() => {
|
|
470
|
+
return getSelectableOutlines(timelinePosition);
|
|
471
|
+
}, [getSelectableOutlines, timelinePosition]);
|
|
472
|
+
const outlineRuntimeControls = (0, react_1.useMemo)(() => {
|
|
473
|
+
return selectableOutlines.flatMap(({ key, sequence }) => {
|
|
474
|
+
if (!selectedSequenceKeys.has(key) &&
|
|
475
|
+
!sequenceKeysContainingSelection.has(key)) {
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
return sequence.controls ? [sequence.controls] : [];
|
|
797
479
|
});
|
|
798
480
|
}, [
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
481
|
+
selectableOutlines,
|
|
482
|
+
selectedSequenceKeys,
|
|
483
|
+
sequenceKeysContainingSelection,
|
|
484
|
+
]);
|
|
485
|
+
const outlineRuntimeSnapshots = (0, use_runtime_values_1.useRuntimeValueSnapshots)(outlineRuntimeControls);
|
|
486
|
+
const outlineRuntimeValuesByStore = (0, react_1.useMemo)(() => new Map(outlineRuntimeControls.map((controls, index) => [
|
|
487
|
+
controls.runtimeValues,
|
|
488
|
+
outlineRuntimeSnapshots[index],
|
|
489
|
+
])), [outlineRuntimeControls, outlineRuntimeSnapshots]);
|
|
490
|
+
const outlineTargets = (0, react_1.useMemo)(() => calculateOutlineTargetsForCurrentState({
|
|
491
|
+
mode: 'layout',
|
|
492
|
+
runtimeValuesByStore: outlineRuntimeValuesByStore,
|
|
493
|
+
selectableOutlines,
|
|
494
|
+
targetKey: null,
|
|
495
|
+
targetTimelinePosition: timelinePosition,
|
|
496
|
+
}), [
|
|
497
|
+
calculateOutlineTargetsForCurrentState,
|
|
813
498
|
outlineRuntimeValuesByStore,
|
|
499
|
+
selectableOutlines,
|
|
500
|
+
timelinePosition,
|
|
814
501
|
]);
|
|
815
|
-
(0, react_1.
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
}, [
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
},
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
},
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
const guidesForSnap = (0, react_1.useMemo)(() => {
|
|
854
|
-
if (!editorShowGuides || (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) !== 'composition') {
|
|
502
|
+
const outlineTargetsRef = (0, react_1.useRef)(outlineTargets);
|
|
503
|
+
const getOutlineTargets = (0, react_1.useCallback)(() => outlineTargetsRef.current, []);
|
|
504
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
505
|
+
outlineTargetsRef.current = outlineTargets;
|
|
506
|
+
updateOutlinesRef.current();
|
|
507
|
+
}, [outlineTargets, scale, translationX, translationY]);
|
|
508
|
+
return (jsx_runtime_1.jsx(SelectedOutlineRenderer_1.SelectedOutlineRenderer, { compositionHeight: compositionHeight, compositionWidth: compositionWidth, dragging: draggingOutline, getLatestOutlineTargetByKey: getLatestOutlineTargetByKey, getOutlineTargets: getOutlineTargets, onDraggingChange: onDraggingChange, onContextMenuOpenChange: onContextMenuOpenChange, onSelect: onSelect, scale: scale, sequences: sequences, updateOutlinesRef: updateOutlinesRef }));
|
|
509
|
+
};
|
|
510
|
+
const ActiveSelectedOutlineOverlay = react_1.default.memo(ActiveSelectedOutlineOverlayUnmemoized);
|
|
511
|
+
const SelectedOutlineOverlayUnmemoized = ({ canvasHovered, compositionHeight, compositionWidth, scale, translationX, translationY, }) => {
|
|
512
|
+
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
513
|
+
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
514
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
515
|
+
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
516
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
517
|
+
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
518
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
519
|
+
const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
520
|
+
const { manuallyEnabledSequenceKeys } = (0, react_1.useContext)(transform_3d_mode_1.Transform3DModeStateContext);
|
|
521
|
+
const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
522
|
+
const setHoveredSequence = (0, timeline_sequence_hover_1.useSetTimelineSequenceHover)();
|
|
523
|
+
const hoveredSequence = (0, timeline_sequence_hover_1.useTimelineSequenceHoverState)();
|
|
524
|
+
const isFullscreen = (0, use_is_fullscreen_1.useIsFullscreen)();
|
|
525
|
+
const { getCurrentFrame } = player_1.PlayerInternals.usePlayerMethods();
|
|
526
|
+
const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
|
|
527
|
+
const [canvasContextMenuOpen, setCanvasContextMenuOpen] = (0, react_1.useState)(false);
|
|
528
|
+
const previewSelectionAvailable = previewServerState.type === 'connected' || window.remotion_isReadOnlyStudio;
|
|
529
|
+
const selectedSequenceKeys = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedSequenceKeys)(selectedItems), [selectedItems]);
|
|
530
|
+
const sequenceKeysContainingSelection = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSequenceKeysContainingSelection)(selectedItems), [selectedItems]);
|
|
531
|
+
const selectedEffectsBySequenceKey = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedEffectFieldsBySequenceKey)(selectedItems), [selectedItems]);
|
|
532
|
+
const selectedTransformOriginInfo = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedTransformOriginInfo)(selectedItems), [selectedItems]);
|
|
533
|
+
const selectedRotationInfo = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedRotationInfo)(selectedItems), [selectedItems]);
|
|
534
|
+
const selectedCropInfo = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedCropInfo)(selectedItems), [selectedItems]);
|
|
535
|
+
const getSelectableOutlines = (0, react_1.useCallback)((timelinePosition) => {
|
|
536
|
+
if (isFullscreen ||
|
|
537
|
+
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
538
|
+
!previewSelectionAvailable ||
|
|
539
|
+
!editorShowOutlines) {
|
|
855
540
|
return [];
|
|
856
541
|
}
|
|
857
|
-
return
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
compositionWidth,
|
|
863
|
-
guides: guidesForSnap,
|
|
864
|
-
});
|
|
865
|
-
}, [compositionHeight, compositionWidth, guidesForSnap]);
|
|
866
|
-
const saveKeyboardNudgeSession = (0, react_1.useCallback)(() => {
|
|
867
|
-
const session = keyboardNudgeSessionRef.current;
|
|
868
|
-
if (session === null) {
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
keyboardNudgeSessionRef.current = null;
|
|
872
|
-
const changes = (0, selected_outline_drag_1.getSelectedOutlineDragChanges)({
|
|
873
|
-
dragStates: session.dragStates,
|
|
874
|
-
lastValues: session.lastValues,
|
|
875
|
-
});
|
|
876
|
-
if (changes.length === 0) {
|
|
877
|
-
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
878
|
-
clearDragOverrides,
|
|
879
|
-
dragStates: session.dragStates,
|
|
880
|
-
});
|
|
881
|
-
return;
|
|
882
|
-
}
|
|
883
|
-
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
884
|
-
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
885
|
-
Promise.all([
|
|
886
|
-
staticChanges.length > 0
|
|
887
|
-
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
888
|
-
changes: staticChanges,
|
|
889
|
-
addedKeyframes: null,
|
|
890
|
-
movedKeyframes: null,
|
|
891
|
-
setPropStatuses,
|
|
892
|
-
clientId: session.clientId,
|
|
893
|
-
undoLabel: changes.length > 1 ? 'Move selected sequences' : 'Move sequence',
|
|
894
|
-
redoLabel: changes.length > 1
|
|
895
|
-
? 'Move selected sequences back'
|
|
896
|
-
: 'Move sequence back',
|
|
897
|
-
})
|
|
898
|
-
: Promise.resolve(),
|
|
899
|
-
(0, call_add_keyframe_1.callAddKeyframes)({
|
|
900
|
-
sequenceKeyframes: keyframedChanges,
|
|
901
|
-
effectKeyframes: [],
|
|
902
|
-
setPropStatuses,
|
|
903
|
-
clientId: session.clientId,
|
|
904
|
-
}),
|
|
905
|
-
])
|
|
906
|
-
.catch((err) => {
|
|
907
|
-
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
908
|
-
})
|
|
909
|
-
.finally(() => {
|
|
910
|
-
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
911
|
-
clearDragOverrides,
|
|
912
|
-
dragStates: session.dragStates,
|
|
913
|
-
});
|
|
914
|
-
});
|
|
915
|
-
}, [clearDragOverrides, setPropStatuses]);
|
|
916
|
-
(0, react_1.useEffect)(() => {
|
|
917
|
-
saveKeyboardNudgeSessionRef.current = saveKeyboardNudgeSession;
|
|
918
|
-
}, [saveKeyboardNudgeSession]);
|
|
919
|
-
(0, react_1.useEffect)(() => {
|
|
920
|
-
return () => {
|
|
921
|
-
saveKeyboardNudgeSessionRef.current();
|
|
922
|
-
};
|
|
923
|
-
}, []);
|
|
924
|
-
const seekWithArrowKey = (0, react_1.useCallback)((event, direction) => {
|
|
925
|
-
if (direction === 'up' || direction === 'down') {
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
event.preventDefault();
|
|
929
|
-
if (direction === 'left') {
|
|
930
|
-
if (event.altKey) {
|
|
931
|
-
seek(0);
|
|
932
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
933
|
-
direction: 'fit-left',
|
|
934
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
935
|
-
frame: 0,
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
else if (event.shiftKey) {
|
|
939
|
-
frameBack((0, imperative_state_1.getCurrentFps)());
|
|
940
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
941
|
-
direction: 'fit-left',
|
|
942
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
943
|
-
frame: Math.max(0, getCurrentFrame() - (0, imperative_state_1.getCurrentFps)()),
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
else {
|
|
947
|
-
frameBack(1);
|
|
948
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
949
|
-
direction: 'fit-left',
|
|
950
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
951
|
-
frame: Math.max(0, getCurrentFrame() - 1),
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
return;
|
|
955
|
-
}
|
|
956
|
-
if (event.altKey) {
|
|
957
|
-
seek((0, imperative_state_1.getCurrentDuration)() - 1);
|
|
958
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
959
|
-
direction: 'fit-right',
|
|
960
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
961
|
-
frame: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
else if (event.shiftKey) {
|
|
965
|
-
frameForward((0, imperative_state_1.getCurrentFps)());
|
|
966
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
967
|
-
direction: 'fit-right',
|
|
968
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
969
|
-
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + (0, imperative_state_1.getCurrentFps)()),
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
else {
|
|
973
|
-
frameForward(1);
|
|
974
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
975
|
-
direction: 'fit-right',
|
|
976
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
977
|
-
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + 1),
|
|
978
|
-
});
|
|
979
|
-
}
|
|
980
|
-
}, [frameBack, frameForward, getCurrentFrame, seek]);
|
|
981
|
-
const onArrowKeyDown = (0, react_1.useCallback)((event) => {
|
|
982
|
-
var _a;
|
|
983
|
-
const direction = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDirection)(event.key);
|
|
984
|
-
if (direction === null) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
if (selectedItems.length === 0 || allDragTargets.length === 0) {
|
|
988
|
-
seekWithArrowKey(event, direction);
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
if (event.altKey) {
|
|
992
|
-
seekWithArrowKey(event, direction);
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
event.preventDefault();
|
|
996
|
-
const activeSession = (_a = keyboardNudgeSessionRef.current) !== null && _a !== void 0 ? _a : (() => {
|
|
997
|
-
const [firstDragTarget] = allDragTargets;
|
|
998
|
-
if (firstDragTarget === undefined) {
|
|
999
|
-
throw new Error('Expected a drag target');
|
|
1000
|
-
}
|
|
1001
|
-
return {
|
|
1002
|
-
clientId: firstDragTarget.clientId,
|
|
1003
|
-
deltaX: 0,
|
|
1004
|
-
deltaY: 0,
|
|
1005
|
-
dragStates: (0, selected_outline_drag_1.getSelectedOutlineDragStates)({
|
|
1006
|
-
dragTargets: allDragTargets,
|
|
1007
|
-
getDragOverrides,
|
|
1008
|
-
timelinePosition,
|
|
1009
|
-
}),
|
|
1010
|
-
lastValues: new Map(),
|
|
1011
|
-
};
|
|
1012
|
-
})();
|
|
1013
|
-
keyboardNudgeSessionRef.current = activeSession;
|
|
1014
|
-
const nextDeltas = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDeltas)({
|
|
1015
|
-
deltaX: activeSession.deltaX,
|
|
1016
|
-
deltaY: activeSession.deltaY,
|
|
1017
|
-
direction,
|
|
1018
|
-
shiftKey: event.shiftKey,
|
|
1019
|
-
});
|
|
1020
|
-
activeSession.deltaX = nextDeltas.deltaX;
|
|
1021
|
-
activeSession.deltaY = nextDeltas.deltaY;
|
|
1022
|
-
const lastValues = (0, selected_outline_drag_1.getSelectedOutlineDragValues)({
|
|
1023
|
-
dragStates: activeSession.dragStates,
|
|
1024
|
-
deltaX: activeSession.deltaX,
|
|
1025
|
-
deltaY: activeSession.deltaY,
|
|
542
|
+
return (0, selected_outline_measurement_1.getSequencesWithSelectableOutlines)({
|
|
543
|
+
sequences,
|
|
544
|
+
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
545
|
+
compositions,
|
|
546
|
+
timelinePosition,
|
|
1026
547
|
});
|
|
1027
|
-
activeSession.lastValues = lastValues;
|
|
1028
|
-
for (const dragState of activeSession.dragStates) {
|
|
1029
|
-
const value = lastValues.get(dragState.key);
|
|
1030
|
-
if (value === undefined) {
|
|
1031
|
-
throw new Error('Expected drag value to be available');
|
|
1032
|
-
}
|
|
1033
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
1034
|
-
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
1035
|
-
status: dragState.target.propStatus,
|
|
1036
|
-
frame: dragState.sourceFrame,
|
|
1037
|
-
value,
|
|
1038
|
-
}));
|
|
1039
|
-
}
|
|
1040
|
-
else {
|
|
1041
|
-
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
548
|
}, [
|
|
1045
|
-
|
|
549
|
+
compositions,
|
|
550
|
+
editorShowOutlines,
|
|
551
|
+
isFullscreen,
|
|
552
|
+
overrideIdToNodePathMappings,
|
|
553
|
+
previewSelectionAvailable,
|
|
554
|
+
sequences,
|
|
555
|
+
]);
|
|
556
|
+
const calculateOutlineTargetsForCurrentState = (0, react_1.useCallback)((options) => calculateOutlineTargets({
|
|
557
|
+
...options,
|
|
558
|
+
connectedClientId: previewServerState.type === 'connected'
|
|
559
|
+
? previewServerState.clientId
|
|
560
|
+
: null,
|
|
561
|
+
editorShowOutlines,
|
|
1046
562
|
getDragOverrides,
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
563
|
+
getScaleLockState,
|
|
564
|
+
isFullscreen,
|
|
565
|
+
manuallyEnabled3DTransformSequenceKeys: manuallyEnabledSequenceKeys,
|
|
566
|
+
previewSelectionAvailable,
|
|
567
|
+
propStatuses,
|
|
568
|
+
selectedCropInfo,
|
|
569
|
+
selectedEffectsBySequenceKey,
|
|
570
|
+
selectedRotationInfo,
|
|
571
|
+
selectedSequenceKeys,
|
|
572
|
+
selectedTransformOriginInfo,
|
|
573
|
+
sequenceKeysContainingSelection,
|
|
574
|
+
studioInteractivityEnabled: (0, interactivity_enabled_1.isStudioInteractivityEnabled)(),
|
|
575
|
+
}), [
|
|
576
|
+
editorShowOutlines,
|
|
577
|
+
getDragOverrides,
|
|
578
|
+
getScaleLockState,
|
|
579
|
+
isFullscreen,
|
|
580
|
+
manuallyEnabledSequenceKeys,
|
|
581
|
+
previewSelectionAvailable,
|
|
582
|
+
previewServerState,
|
|
583
|
+
propStatuses,
|
|
584
|
+
selectedCropInfo,
|
|
585
|
+
selectedEffectsBySequenceKey,
|
|
586
|
+
selectedRotationInfo,
|
|
587
|
+
selectedSequenceKeys,
|
|
588
|
+
selectedTransformOriginInfo,
|
|
589
|
+
sequenceKeysContainingSelection,
|
|
1051
590
|
]);
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
event: 'keyup',
|
|
1072
|
-
key,
|
|
1073
|
-
callback: onArrowKeyUp,
|
|
1074
|
-
commandCtrlKey: false,
|
|
1075
|
-
preventDefault: false,
|
|
1076
|
-
triggerIfInputFieldFocused: false,
|
|
1077
|
-
keepRegisteredWhenNotHighestContext: false,
|
|
1078
|
-
}));
|
|
1079
|
-
return () => {
|
|
1080
|
-
for (const binding of [...keyDownBindings, ...keyUpBindings]) {
|
|
1081
|
-
binding.unregister();
|
|
1082
|
-
}
|
|
591
|
+
const calculateOutlineTargetsRef = (0, react_1.useRef)(calculateOutlineTargetsForCurrentState);
|
|
592
|
+
const getSelectableOutlinesRef = (0, react_1.useRef)(getSelectableOutlines);
|
|
593
|
+
const selectableOutlinesCacheRef = (0, react_1.useRef)(null);
|
|
594
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
595
|
+
calculateOutlineTargetsRef.current = calculateOutlineTargetsForCurrentState;
|
|
596
|
+
getSelectableOutlinesRef.current = getSelectableOutlines;
|
|
597
|
+
}, [calculateOutlineTargetsForCurrentState, getSelectableOutlines]);
|
|
598
|
+
const getSelectableOutlinesAtFrame = (0, react_1.useCallback)((timelinePosition) => {
|
|
599
|
+
const currentGetSelectableOutlines = getSelectableOutlinesRef.current;
|
|
600
|
+
const cached = selectableOutlinesCacheRef.current;
|
|
601
|
+
if ((cached === null || cached === void 0 ? void 0 : cached.timelinePosition) === timelinePosition &&
|
|
602
|
+
cached.getSelectableOutlines === currentGetSelectableOutlines) {
|
|
603
|
+
return cached.selectableOutlines;
|
|
604
|
+
}
|
|
605
|
+
const selectableOutlines = currentGetSelectableOutlines(timelinePosition);
|
|
606
|
+
selectableOutlinesCacheRef.current = {
|
|
607
|
+
getSelectableOutlines: currentGetSelectableOutlines,
|
|
608
|
+
selectableOutlines,
|
|
609
|
+
timelinePosition,
|
|
1083
610
|
};
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
611
|
+
return selectableOutlines;
|
|
612
|
+
}, []);
|
|
613
|
+
const getLatestOutlineTargetByKey = (0, react_1.useCallback)((key) => {
|
|
614
|
+
const timelinePosition = getCurrentFrame();
|
|
615
|
+
const target = calculateOutlineTargetsRef.current({
|
|
616
|
+
mode: 'controls',
|
|
617
|
+
runtimeValuesByStore: new Map(),
|
|
618
|
+
selectableOutlines: getSelectableOutlinesAtFrame(timelinePosition),
|
|
619
|
+
targetKey: key,
|
|
620
|
+
targetTimelinePosition: timelinePosition,
|
|
621
|
+
})[0];
|
|
622
|
+
return target;
|
|
623
|
+
}, [getCurrentFrame, getSelectableOutlinesAtFrame]);
|
|
624
|
+
const getCurrentSelectableOutlines = (0, react_1.useCallback)(() => getSelectableOutlinesAtFrame(getCurrentFrame()), [getCurrentFrame, getSelectableOutlinesAtFrame]);
|
|
625
|
+
const onDraggingChange = (0, react_1.useCallback)((dragging) => {
|
|
626
|
+
setDraggingOutline(dragging);
|
|
627
|
+
if (dragging) {
|
|
628
|
+
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
1089
629
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
630
|
+
}, [setHoveredSequence]);
|
|
631
|
+
const selectOutlineItem = (0, react_1.useCallback)((item, interaction) => {
|
|
632
|
+
selectItem(item, interaction, undefined, { reveal: true });
|
|
633
|
+
}, [selectItem]);
|
|
634
|
+
const measurementActive = canvasHovered ||
|
|
635
|
+
draggingOutline ||
|
|
636
|
+
canvasContextMenuOpen ||
|
|
637
|
+
sequenceKeysContainingSelection.size > 0 ||
|
|
638
|
+
(hoveredSequence === null || hoveredSequence === void 0 ? void 0 : hoveredSequence.source) === 'timeline';
|
|
1098
639
|
(0, react_1.useLayoutEffect)(() => {
|
|
1099
|
-
if (
|
|
640
|
+
if (measurementActive) {
|
|
1100
641
|
return;
|
|
1101
642
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
}
|
|
1107
|
-
animationFrame = requestAnimationFrame(() => {
|
|
1108
|
-
animationFrame = null;
|
|
1109
|
-
updateOutlines();
|
|
1110
|
-
});
|
|
1111
|
-
};
|
|
1112
|
-
const resizeObserver = new ResizeObserver(scheduleUpdate);
|
|
1113
|
-
if (overlayRef.current !== null) {
|
|
1114
|
-
resizeObserver.observe(overlayRef.current);
|
|
1115
|
-
}
|
|
1116
|
-
for (const target of outlineTargets) {
|
|
1117
|
-
if (target.ref.current !== null) {
|
|
1118
|
-
resizeObserver.observe(target.ref.current);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
return () => {
|
|
1122
|
-
if (animationFrame !== null) {
|
|
1123
|
-
cancelAnimationFrame(animationFrame);
|
|
1124
|
-
}
|
|
1125
|
-
resizeObserver.disconnect();
|
|
1126
|
-
};
|
|
1127
|
-
}, [outlineTargets, updateOutlines]);
|
|
1128
|
-
if (outlineTargets.length === 0) {
|
|
1129
|
-
return null;
|
|
1130
|
-
}
|
|
1131
|
-
return (jsx_runtime_1.jsxs("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: [
|
|
1132
|
-
jsx_runtime_1.jsx(SelectedOutlineSnapIndicators, { activeSnapPoints: activeSnapPoints, compositionHeight: compositionHeight, compositionWidth: compositionWidth, scale: scale }), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineElement, { allDragTargets: allDragTargets, allDragOutlines: allDragOutlines, allRotationDragTargets: allRotationDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: (hoveredSequence === null || hoveredSequence === void 0 ? void 0 : hoveredSequence.key) === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSnapPointsChange: onSnapPointsChange, onSelect: selectOutlineItem, scale: scale, snapTargets: snapTargets, target: targetsByKey.get(outline.key) }, outline.key))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineTransformOriginHandle, { outline: outline, onDraggingChange: onDraggingChange, target: targetsByKey.get(outline.key) }, `${outline.key}-transform-origin`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, onSelect: selectOutlineItem, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
|
|
643
|
+
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
644
|
+
}, [measurementActive, setHoveredSequence]);
|
|
645
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
646
|
+
jsx_runtime_1.jsx(SelectedOutlineKeyboardControls_1.SelectedOutlineKeyboardControls, { getLatestOutlineTargetByKey: getLatestOutlineTargetByKey, getSelectableOutlines: getCurrentSelectableOutlines }), measurementActive ? (jsx_runtime_1.jsx(ActiveSelectedOutlineOverlay, { calculateOutlineTargetsForCurrentState: calculateOutlineTargetsForCurrentState, compositionHeight: compositionHeight, compositionWidth: compositionWidth, draggingOutline: draggingOutline, getLatestOutlineTargetByKey: getLatestOutlineTargetByKey, getSelectableOutlines: getSelectableOutlines, onDraggingChange: onDraggingChange, onContextMenuOpenChange: setCanvasContextMenuOpen, onSelect: selectOutlineItem, scale: scale, selectedSequenceKeys: selectedSequenceKeys, sequenceKeysContainingSelection: sequenceKeysContainingSelection, sequences: sequences, translationX: translationX, translationY: translationY })) : null] }));
|
|
1133
647
|
};
|
|
1134
|
-
exports.SelectedOutlineOverlay =
|
|
648
|
+
exports.SelectedOutlineOverlay = react_1.default.memo(SelectedOutlineOverlayUnmemoized);
|