@remotion/studio 4.0.505 → 4.0.507
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/copy-render-output-to-asset.d.ts +4 -0
- package/dist/api/copy-render-output-to-asset.js +11 -0
- package/dist/api/install-package.d.ts +2 -3
- package/dist/api/install-package.js +1 -3
- package/dist/api/visual-control.d.ts +3 -0
- package/dist/api/visual-control.js +3 -0
- package/dist/components/AssetSelector.js +19 -4
- package/dist/components/AssetSelectorItem.js +3 -3
- package/dist/components/Canvas.js +2 -0
- package/dist/components/CodingAgentIcon.d.ts +4 -0
- package/dist/components/CodingAgentIcon.js +17 -0
- package/dist/components/CompositionSelector.js +1 -1
- package/dist/components/CompositionSelectorItem.js +1 -1
- package/dist/components/ConfigureDefaultEditorModal.d.ts +1 -1
- package/dist/components/ConfigureDefaultEditorModal.js +117 -69
- package/dist/components/ConfigureLicenseModal.d.ts +1 -3
- package/dist/components/ConfigureLicenseModal.js +105 -89
- package/dist/components/ConfirmationDialog.js +2 -2
- package/dist/components/ContextMenu.js +10 -8
- package/dist/components/Editor.js +2 -0
- package/dist/components/EditorContexts.js +6 -5
- package/dist/components/EffectPickerModal.js +1 -1
- package/dist/components/ExpandedTracksProvider.js +10 -53
- package/dist/components/GlobalKeybindings.js +3 -2
- package/dist/components/InlineCaptionInspector.d.ts +2 -2
- package/dist/components/InlineDropdown.d.ts +2 -1
- package/dist/components/InlineDropdown.js +10 -4
- package/dist/components/InspectorLocationCopy.js +8 -8
- package/dist/components/InspectorOpenInEditor.d.ts +2 -0
- package/dist/components/InspectorOpenInEditor.js +63 -49
- package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +15 -1
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +1 -1
- package/dist/components/InspectorPanel/EasingInspector.js +7 -4
- package/dist/components/InspectorPanel/KeyframeInspector.js +5 -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/common.d.ts +1 -0
- package/dist/components/InspectorPanel/common.js +2 -2
- package/dist/components/InspectorPanel/use-composition-actions.js +4 -1
- package/dist/components/InspectorSequenceSection.js +4 -4
- package/dist/components/InstallPackage.js +1 -1
- 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 -0
- package/dist/components/MenuToolbar.js +1 -1
- package/dist/components/ModalFooter.d.ts +1 -0
- package/dist/components/ModalFooter.js +6 -2
- package/dist/components/ModalHeader.js +1 -1
- package/dist/components/Modals.js +18 -7
- package/dist/components/ModalsProvider.js +5 -6
- package/dist/components/NewComposition/CodemodFooter.js +1 -1
- package/dist/components/NewComposition/ComboBox.d.ts +6 -1
- package/dist/components/NewComposition/DismissableModal.js +1 -1
- package/dist/components/NewComposition/MenuContent.js +27 -19
- package/dist/components/NewComposition/RenameStaticFile.js +1 -1
- package/dist/components/NewComposition/menu-typeahead.js +2 -2
- package/dist/components/OverrideInputProps.js +1 -1
- package/dist/components/PlayPause.js +2 -1
- package/dist/components/PlaybackKeyboardShortcutsManager.js +7 -5
- package/dist/components/Preview.js +29 -4
- package/dist/components/PreviewToolbarOverflowButton.js +4 -2
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -1
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -1
- package/dist/components/RenderButton.d.ts +3 -3
- package/dist/components/RenderButton.js +42 -7
- package/dist/components/RenderModal/RenderStatusModal.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/ServerRenderModal.js +5 -1
- package/dist/components/RenderModal/WebRenderModal.js +3 -2
- package/dist/components/RenderQueue/RenderQueueError.js +1 -1
- package/dist/components/RenderQueue/RenderQueueItem.js +8 -2
- package/dist/components/RenderQueue/RenderQueueItemStatus.js +1 -1
- package/dist/components/RenderQueue/RenderQueueProgressMessage.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +1 -1
- 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/SelectedOutlineElement.d.ts +14 -17
- package/dist/components/SelectedOutlineElement.js +113 -931
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +7 -0
- package/dist/components/SelectedOutlineKeyboardControls.js +261 -0
- package/dist/components/SelectedOutlineOverlay.d.ts +6 -13
- package/dist/components/SelectedOutlineOverlay.js +360 -832
- package/dist/components/SelectedOutlinePolygon.d.ts +25 -0
- package/dist/components/SelectedOutlinePolygon.js +359 -0
- package/dist/components/SelectedOutlineRenderer.d.ts +18 -0
- package/dist/components/SelectedOutlineRenderer.js +208 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +16 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +269 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +16 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +211 -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 +286 -0
- package/dist/components/SelectedOutlineUvControls.d.ts +3 -9
- package/dist/components/SelectedOutlineUvControls.js +57 -12
- package/dist/components/SettingsContext.d.ts +15 -0
- package/dist/components/SettingsContext.js +116 -0
- package/dist/components/SettingsModal.d.ts +7 -0
- package/dist/components/SettingsModal.js +56 -0
- package/dist/components/SettingsModalFooter.d.ts +2 -0
- package/dist/components/SettingsModalFooter.js +44 -0
- package/dist/components/ShowOutlinesProvider.js +2 -3
- package/dist/components/SidebarRenderButton.js +1 -1
- package/dist/components/SvgImportDialog.js +2 -2
- package/dist/components/TimeValue.js +1 -1
- package/dist/components/Timeline/EasingEditorModal.js +66 -22
- package/dist/components/Timeline/Timeline.js +23 -5
- package/dist/components/Timeline/TimelineAssetField.js +1 -1
- package/dist/components/Timeline/TimelineDragHandler.js +3 -3
- package/dist/components/Timeline/TimelineDuplicateCount.d.ts +4 -0
- package/dist/components/Timeline/TimelineDuplicateCount.js +28 -0
- package/dist/components/Timeline/TimelineEffectPropItem.js +5 -3
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +3 -23
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +4 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +2 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +4 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -1
- package/dist/components/Timeline/TimelineFontFamilyField.js +3 -1
- package/dist/components/Timeline/TimelineKeyframeControls.js +1 -0
- package/dist/components/Timeline/TimelineSelection.js +1 -0
- package/dist/components/Timeline/TimelineSequence.js +28 -25
- package/dist/components/Timeline/TimelineSequenceItem.js +74 -58
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +1 -1
- package/dist/components/Timeline/TimelineTrack.js +2 -1
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -3
- package/dist/components/Timeline/get-sequence-context-menu-items.js +58 -53
- package/dist/components/Timeline/reset-selected-timeline-props.js +1 -1
- package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +1 -1
- package/dist/components/Timeline/timeline-asset-link.d.ts +2 -2
- package/dist/components/Timeline/timeline-asset-link.js +2 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +38 -2
- 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} +20 -4
- package/dist/components/Timeline/use-timeline-asset-drop.js +1 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +5 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +50 -1
- package/dist/components/Timeline/use-timeline-height.js +20 -0
- package/dist/components/TimelineInOutToggle.js +5 -1
- package/dist/components/TopPanel.js +16 -0
- package/dist/components/UpdateCheck.js +1 -1
- package/dist/components/effect-drag-and-drop.js +1 -1
- package/dist/components/get-open-in-menu-items.d.ts +12 -0
- package/dist/components/get-open-in-menu-items.js +83 -0
- package/dist/components/handle-drop.d.ts +2 -1
- package/dist/components/handle-drop.js +12 -2
- package/dist/components/import-assets.d.ts +18 -6
- package/dist/components/import-assets.js +76 -32
- package/dist/components/selected-outline-measurement.d.ts +2 -2
- 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 +9 -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-7pgk8h5m.js → chunk-ptnd65a9.js} +14596 -12725
- package/dist/esm/internals.mjs +14595 -12724
- package/dist/esm/previewEntry.mjs +12726 -10855
- 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.d.ts +3 -1
- package/dist/helpers/client-id.js +28 -4
- package/dist/helpers/format-file-location.d.ts +1 -1
- package/dist/helpers/format-file-location.js +3 -3
- package/dist/helpers/install-required-package.d.ts +3 -3
- package/dist/helpers/install-required-package.js +1 -6
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
- package/dist/helpers/open-in-editor.d.ts +1 -0
- package/dist/helpers/open-in-editor.js +5 -1
- package/dist/helpers/studio-fit-padding.d.ts +1 -1
- package/dist/helpers/studio-fit-padding.js +1 -1
- package/dist/helpers/studio-runtime-config.js +3 -0
- package/dist/helpers/timeline-layout.d.ts +2 -1
- package/dist/helpers/timeline-layout.js +5 -2
- 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 +25 -35
- package/dist/helpers/use-runtime-values.d.ts +9 -0
- package/dist/helpers/use-runtime-values.js +76 -0
- package/dist/icons/apps.d.ts +2 -0
- package/dist/icons/apps.js +7 -0
- package/dist/icons/browse-elements.d.ts +4 -0
- package/dist/icons/browse-elements.js +10 -0
- package/dist/state/modals.d.ts +5 -6
- package/dist/state/modals.js +5 -3
- package/dist/state/timeline-sequence-hover.d.ts +9 -3
- package/dist/state/timeline-sequence-hover.js +63 -12
- 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.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,24 +41,19 @@ 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
|
|
46
|
-
const editor_guides_1 = require("../state/editor-guides");
|
|
46
|
+
const use_runtime_values_1 = require("../helpers/use-runtime-values");
|
|
47
47
|
const editor_outlines_1 = require("../state/editor-outlines");
|
|
48
48
|
const scale_lock_1 = require("../state/scale-lock");
|
|
49
49
|
const timeline_sequence_hover_1 = require("../state/timeline-sequence-hover");
|
|
50
|
-
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
51
50
|
const selected_outline_drag_1 = require("./selected-outline-drag");
|
|
52
51
|
const selected_outline_measurement_1 = require("./selected-outline-measurement");
|
|
53
|
-
const
|
|
52
|
+
const selected_outline_order_1 = require("./selected-outline-order");
|
|
53
|
+
Object.defineProperty(exports, "orderOutlinesForRendering", { enumerable: true, get: function () { return selected_outline_order_1.orderOutlinesForRendering; } });
|
|
54
54
|
const selected_outline_types_1 = require("./selected-outline-types");
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const SelectedOutlineUvControls_1 = require("./SelectedOutlineUvControls");
|
|
58
|
-
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
59
|
-
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
60
|
-
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
61
|
-
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
55
|
+
const SelectedOutlineKeyboardControls_1 = require("./SelectedOutlineKeyboardControls");
|
|
56
|
+
const SelectedOutlineRenderer_1 = require("./SelectedOutlineRenderer");
|
|
62
57
|
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
63
58
|
const selected_outline_drag_2 = require("./selected-outline-drag");
|
|
64
59
|
Object.defineProperty(exports, "applySelectedOutlineDragAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineDragAxisLock; } });
|
|
@@ -99,7 +94,7 @@ Object.defineProperty(exports, "getSequencesWithSelectableOutlines", { enumerabl
|
|
|
99
94
|
Object.defineProperty(exports, "getTransformedSvgViewportPoints", { enumerable: true, get: function () { return selected_outline_measurement_2.getTransformedSvgViewportPoints; } });
|
|
100
95
|
const selected_outline_types_2 = require("./selected-outline-types");
|
|
101
96
|
Object.defineProperty(exports, "selectedOutlineDragThresholdPx", { enumerable: true, get: function () { return selected_outline_types_2.selectedOutlineDragThresholdPx; } });
|
|
102
|
-
const getEffectiveCropValue = ({ activeSchema,
|
|
97
|
+
const getEffectiveCropValue = ({ activeSchema, dragOverrides, fieldKey, frame, propStatuses, runtimeValues, }) => {
|
|
103
98
|
var _a;
|
|
104
99
|
const fieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[fieldKey];
|
|
105
100
|
if ((fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) !== 'number') {
|
|
@@ -114,7 +109,7 @@ const getEffectiveCropValue = ({ activeSchema, controls, dragOverrides, fieldKey
|
|
|
114
109
|
frame,
|
|
115
110
|
shouldResortToDefaultValueIfUndefined: true,
|
|
116
111
|
})
|
|
117
|
-
: ((_a =
|
|
112
|
+
: ((_a = runtimeValues[fieldKey]) !== null && _a !== void 0 ? _a : fieldSchema.default);
|
|
118
113
|
return typeof value === 'number' && Number.isFinite(value) ? value : 0;
|
|
119
114
|
};
|
|
120
115
|
const getCropDragFields = ({ activeSchema, cropValues, propStatuses, }) => {
|
|
@@ -143,477 +138,196 @@ const getCropDragFields = ({ activeSchema, cropValues, propStatuses, }) => {
|
|
|
143
138
|
}
|
|
144
139
|
return fields;
|
|
145
140
|
};
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const SelectedOutlineSnapIndicators = ({ activeSnapPoints, compositionHeight, compositionWidth, scale }) => {
|
|
153
|
-
if (activeSnapPoints.length === 0) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
return (jsx_runtime_1.jsx("g", { pointerEvents: "none", children: activeSnapPoints.map((snapPoint) => {
|
|
157
|
-
if (snapPoint.target.axis === 'x') {
|
|
158
|
-
const x = snapPoint.target.position * scale;
|
|
159
|
-
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}`));
|
|
160
|
-
}
|
|
161
|
-
const y = snapPoint.target.position * scale;
|
|
162
|
-
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}`));
|
|
163
|
-
}) }));
|
|
164
|
-
};
|
|
165
|
-
const outlinePointEqualityTolerance = 0.5;
|
|
166
|
-
const outlineAreaEqualityTolerance = 0.5;
|
|
167
|
-
const outlineBoundsOverlapTolerance = 0.5;
|
|
168
|
-
const outlinePointsAreEquivalent = (a, b) => {
|
|
169
|
-
return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
|
|
170
|
-
Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
|
|
171
|
-
};
|
|
172
|
-
const outlinesHaveEquivalentHitArea = (a, b) => {
|
|
173
|
-
if (a.points.length !== b.points.length) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
|
|
177
|
-
for (const direction of [1, -1]) {
|
|
178
|
-
const pointsMatch = a.points.every((point, index) => {
|
|
179
|
-
const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
|
|
180
|
-
return outlinePointsAreEquivalent(point, b.points[bIndex]);
|
|
181
|
-
});
|
|
182
|
-
if (pointsMatch) {
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return false;
|
|
188
|
-
};
|
|
189
|
-
const getOutlineHitArea = (outline) => {
|
|
190
|
-
let area = 0;
|
|
191
|
-
for (let i = 0; i < outline.points.length; i++) {
|
|
192
|
-
const current = outline.points[i];
|
|
193
|
-
const next = outline.points[(i + 1) % outline.points.length];
|
|
194
|
-
area += current.x * next.y - next.x * current.y;
|
|
195
|
-
}
|
|
196
|
-
return Math.abs(area) / 2;
|
|
197
|
-
};
|
|
198
|
-
const getOutlineBounds = (outline) => {
|
|
199
|
-
const xs = outline.points.map((point) => point.x);
|
|
200
|
-
const ys = outline.points.map((point) => point.y);
|
|
201
|
-
return {
|
|
202
|
-
maxX: Math.max(...xs),
|
|
203
|
-
maxY: Math.max(...ys),
|
|
204
|
-
minX: Math.min(...xs),
|
|
205
|
-
minY: Math.min(...ys),
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
const outlineBoundsOverlap = (a, b) => {
|
|
209
|
-
const aBounds = getOutlineBounds(a);
|
|
210
|
-
const bBounds = getOutlineBounds(b);
|
|
211
|
-
return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
|
|
212
|
-
aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
|
|
213
|
-
aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
|
|
214
|
-
aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
|
|
215
|
-
};
|
|
216
|
-
const getSequenceId = (target) => {
|
|
217
|
-
var _a;
|
|
218
|
-
var _b;
|
|
219
|
-
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;
|
|
220
|
-
};
|
|
221
|
-
const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
|
|
222
|
-
const parentBySequenceId = new Map();
|
|
223
|
-
for (const sequence of sequences) {
|
|
224
|
-
parentBySequenceId.set(sequence.id, sequence.parent);
|
|
225
|
-
}
|
|
226
|
-
for (const target of targetsByKey.values()) {
|
|
227
|
-
const sequenceId = getSequenceId(target);
|
|
228
|
-
if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
|
|
229
|
-
parentBySequenceId.set(sequenceId, target.sequence.parent);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return parentBySequenceId;
|
|
233
|
-
};
|
|
234
|
-
const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
|
|
235
|
-
var _a;
|
|
236
|
-
var _b, _c;
|
|
237
|
-
const ancestorId = getSequenceId(ancestor);
|
|
238
|
-
if (ancestorId === null) {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
242
|
-
while (parentId !== null) {
|
|
243
|
-
if (parentId === ancestorId) {
|
|
244
|
-
return true;
|
|
245
|
-
}
|
|
246
|
-
parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
|
|
247
|
-
}
|
|
248
|
-
return false;
|
|
249
|
-
};
|
|
250
|
-
const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
|
|
251
|
-
var _a;
|
|
252
|
-
var _b, _c, _d, _e;
|
|
253
|
-
const incomingEdges = new Map();
|
|
254
|
-
const outgoingEdges = new Map();
|
|
255
|
-
const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
|
|
256
|
-
for (const outline of outlines) {
|
|
257
|
-
incomingEdges.set(outline.key, new Set());
|
|
258
|
-
outgoingEdges.set(outline.key, new Set());
|
|
259
|
-
}
|
|
260
|
-
const hasPath = ({ fromKey, seen, toKey, }) => {
|
|
261
|
-
var _a;
|
|
262
|
-
if (fromKey === toKey) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
if (seen.has(fromKey)) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
seen.add(fromKey);
|
|
269
|
-
for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
|
|
270
|
-
if (hasPath({ fromKey: nextKey, seen, toKey })) {
|
|
271
|
-
return true;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return false;
|
|
275
|
-
};
|
|
276
|
-
const addEdge = (before, after, options) => {
|
|
277
|
-
if (before.key === after.key) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const incoming = incomingEdges.get(after.key);
|
|
281
|
-
const outgoing = outgoingEdges.get(before.key);
|
|
282
|
-
if (incoming === undefined || outgoing === undefined) {
|
|
283
|
-
throw new Error('Expected outline to be registered before adding edge');
|
|
284
|
-
}
|
|
285
|
-
if (outgoing.has(after.key)) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
|
|
289
|
-
if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
293
|
-
}
|
|
294
|
-
incoming.add(before.key);
|
|
295
|
-
outgoing.add(after.key);
|
|
296
|
-
};
|
|
297
|
-
const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
|
|
298
|
-
// Usually, children should be above parents so nested elements are directly
|
|
299
|
-
// selectable. If an unselected child has the same hit area as its parent, put
|
|
300
|
-
// it below the parent so the wrapper can be selected. Once the child or
|
|
301
|
-
// one of its properties is selected, keep it above the parent so it remains
|
|
302
|
-
// directly draggable.
|
|
303
|
-
if (equivalentHitArea && !descendantContainsSelection) {
|
|
304
|
-
addEdge(descendant, ancestor);
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
addEdge(ancestor, descendant);
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
const outlineBySequenceId = new Map();
|
|
311
|
-
for (const outline of outlines) {
|
|
312
|
-
const sequenceId = getSequenceId(targetsByKey.get(outline.key));
|
|
313
|
-
if (sequenceId !== null) {
|
|
314
|
-
outlineBySequenceId.set(sequenceId, outline);
|
|
315
|
-
}
|
|
141
|
+
const calculateOutlineTargets = ({ connectedClientId, editorShowOutlines, getDragOverrides, getScaleLockState, isFullscreen, mode, previewSelectionAvailable, propStatuses, runtimeValuesByStore, selectableOutlines, selectedCropInfo, selectedEffectsBySequenceKey, selectedSequenceKeys, selectedTransformOriginInfo, sequenceKeysContainingSelection, studioInteractivityEnabled, targetKey, targetTimelinePosition, }) => {
|
|
142
|
+
if (isFullscreen ||
|
|
143
|
+
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
144
|
+
!previewSelectionAvailable ||
|
|
145
|
+
!editorShowOutlines) {
|
|
146
|
+
return [];
|
|
316
147
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
for (const
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
descendant,
|
|
329
|
-
descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
|
|
330
|
-
((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
|
|
331
|
-
equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
|
|
332
|
-
});
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
|
|
148
|
+
const previewInteractive = connectedClientId !== null && studioInteractivityEnabled;
|
|
149
|
+
const firstNodePathInfoBySourceNode = new Map();
|
|
150
|
+
const selectedSourceNodeKeys = new Set();
|
|
151
|
+
for (const { key, nodePathInfo } of selectableOutlines) {
|
|
152
|
+
const sourceNodeKey = (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(nodePathInfo.sequenceSubscriptionKey);
|
|
153
|
+
if (selectedSequenceKeys.has(key)) {
|
|
154
|
+
selectedSourceNodeKeys.add(sourceNodeKey);
|
|
155
|
+
}
|
|
156
|
+
const currentFirst = firstNodePathInfoBySourceNode.get(sourceNodeKey);
|
|
157
|
+
if (currentFirst === undefined || nodePathInfo.index < currentFirst.index) {
|
|
158
|
+
firstNodePathInfoBySourceNode.set(sourceNodeKey, nodePathInfo);
|
|
336
159
|
}
|
|
337
160
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
for (let j = i + 1; j < outlines.length; j++) {
|
|
343
|
-
const a = outlines[i];
|
|
344
|
-
const b = outlines[j];
|
|
345
|
-
const aTarget = targetsByKey.get(a.key);
|
|
346
|
-
const bTarget = targetsByKey.get(b.key);
|
|
347
|
-
if (aTarget === undefined || bTarget === undefined) {
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
const aAncestorOfB = isAncestorTarget({
|
|
351
|
-
ancestor: aTarget,
|
|
352
|
-
descendant: bTarget,
|
|
353
|
-
parentBySequenceId,
|
|
354
|
-
});
|
|
355
|
-
const bAncestorOfA = isAncestorTarget({
|
|
356
|
-
ancestor: bTarget,
|
|
357
|
-
descendant: aTarget,
|
|
358
|
-
parentBySequenceId,
|
|
359
|
-
});
|
|
360
|
-
if (aAncestorOfB || bAncestorOfA || !outlineBoundsOverlap(a, b)) {
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
const aArea = getOutlineHitArea(a);
|
|
364
|
-
const bArea = getOutlineHitArea(b);
|
|
365
|
-
if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
|
|
366
|
-
continue;
|
|
367
|
-
}
|
|
368
|
-
if (aArea > bArea) {
|
|
369
|
-
addEdge(a, b, { skipIfCycle: true });
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
addEdge(b, a, { skipIfCycle: true });
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
const emitted = new Set();
|
|
377
|
-
const visiting = new Set();
|
|
378
|
-
const ordered = [];
|
|
379
|
-
const visit = (outline) => {
|
|
380
|
-
var _a;
|
|
381
|
-
if (emitted.has(outline.key)) {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
if (visiting.has(outline.key)) {
|
|
385
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
386
|
-
}
|
|
387
|
-
visiting.add(outline.key);
|
|
388
|
-
for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
|
|
389
|
-
const dependency = outlinesByKey.get(dependencyKey);
|
|
390
|
-
if (dependency === undefined) {
|
|
391
|
-
throw new Error('Expected outline dependency to exist');
|
|
392
|
-
}
|
|
393
|
-
visit(dependency);
|
|
394
|
-
}
|
|
395
|
-
visiting.delete(outline.key);
|
|
396
|
-
emitted.add(outline.key);
|
|
397
|
-
ordered.push(outline);
|
|
398
|
-
};
|
|
399
|
-
for (const outline of outlines) {
|
|
400
|
-
visit(outline);
|
|
401
|
-
}
|
|
402
|
-
return ordered;
|
|
403
|
-
};
|
|
404
|
-
const orderOutlinesForRendering = ({ outlines, sequences, targetsByKey, }) => {
|
|
405
|
-
const parentBySequenceId = getParentBySequenceId({ sequences, targetsByKey });
|
|
406
|
-
return orderOutlineGroup({
|
|
407
|
-
outlines,
|
|
408
|
-
parentBySequenceId,
|
|
409
|
-
targetsByKey,
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
exports.orderOutlinesForRendering = orderOutlinesForRendering;
|
|
413
|
-
const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, translationX, translationY, }) => {
|
|
414
|
-
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
415
|
-
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
416
|
-
const { canvasContent, compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
417
|
-
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
418
|
-
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
419
|
-
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
420
|
-
const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
421
|
-
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
422
|
-
const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
423
|
-
const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
424
|
-
const { hoveredSequence, setHoveredSequence } = (0, react_1.useContext)(timeline_sequence_hover_1.TimelineSequenceHoverContext);
|
|
425
|
-
const { editorShowGuides, guidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
426
|
-
const isFullscreen = (0, use_is_fullscreen_1.useIsFullscreen)();
|
|
427
|
-
const { frameBack, frameForward, getCurrentFrame, seek } = player_1.PlayerInternals.usePlayer();
|
|
428
|
-
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
429
|
-
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
430
|
-
const [outlines, setOutlines] = (0, react_1.useState)([]);
|
|
431
|
-
const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
|
|
432
|
-
const [activeSnapPoints, setActiveSnapPoints] = (0, react_1.useState)([]);
|
|
433
|
-
const overlayRef = (0, react_1.useRef)(null);
|
|
434
|
-
const keyboardNudgeSessionRef = (0, react_1.useRef)(null);
|
|
435
|
-
const saveKeyboardNudgeSessionRef = (0, react_1.useRef)(() => undefined);
|
|
436
|
-
const previewInteractive = previewServerState.type === 'connected' && (0, interactivity_enabled_1.isStudioInteractivityEnabled)();
|
|
437
|
-
const previewSelectionAvailable = previewServerState.type === 'connected' || window.remotion_isReadOnlyStudio;
|
|
438
|
-
const onDraggingChange = react_1.default.useCallback((dragging) => {
|
|
439
|
-
setDraggingOutline(dragging);
|
|
440
|
-
if (dragging) {
|
|
441
|
-
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
setActiveSnapPoints([]);
|
|
445
|
-
}
|
|
446
|
-
}, [setHoveredSequence]);
|
|
447
|
-
const onHoverChange = (0, react_1.useCallback)((key) => {
|
|
448
|
-
setHoveredSequence((currentHover) => {
|
|
449
|
-
if (key !== null) {
|
|
450
|
-
return { key, source: 'canvas' };
|
|
451
|
-
}
|
|
452
|
-
return (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover;
|
|
453
|
-
});
|
|
454
|
-
}, [setHoveredSequence]);
|
|
455
|
-
const onSnapPointsChange = (0, react_1.useCallback)((snapPoints) => {
|
|
456
|
-
setActiveSnapPoints(snapPoints);
|
|
457
|
-
}, []);
|
|
458
|
-
const selectOutlineItem = (0, react_1.useCallback)((item, interaction) => {
|
|
459
|
-
selectItem(item, interaction, undefined, { reveal: true });
|
|
460
|
-
}, [selectItem]);
|
|
461
|
-
const outlineTargets = (0, react_1.useMemo)(() => {
|
|
462
|
-
if (isFullscreen ||
|
|
463
|
-
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
464
|
-
!previewSelectionAvailable ||
|
|
465
|
-
!editorShowOutlines) {
|
|
161
|
+
return selectableOutlines.flatMap((selectableOutline) => {
|
|
162
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
163
|
+
const { key, keyframeDisplayOffset, nodePathInfo, sequence } = selectableOutline;
|
|
164
|
+
if (targetKey !== null && targetKey !== key) {
|
|
466
165
|
return [];
|
|
467
166
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
const
|
|
473
|
-
const
|
|
474
|
-
|
|
167
|
+
if (sequence.refForOutline === null) {
|
|
168
|
+
throw new Error('Expected sequence to have a ref for outline');
|
|
169
|
+
}
|
|
170
|
+
const selected = selectedSequenceKeys.has(key);
|
|
171
|
+
const containsSelection = sequenceKeysContainingSelection.has(key);
|
|
172
|
+
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
173
|
+
const sourceNodeKey = (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(nodePath);
|
|
174
|
+
const showSelectedOutline = containsSelection || selectedSourceNodeKeys.has(sourceNodeKey);
|
|
175
|
+
const selectionNodePathInfo = firstNodePathInfoBySourceNode.get(sourceNodeKey);
|
|
176
|
+
if (selectionNodePathInfo === undefined) {
|
|
177
|
+
throw new Error('Expected a first sequence for the source node');
|
|
178
|
+
}
|
|
179
|
+
const { controls } = sequence;
|
|
180
|
+
const nodePropStatuses = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath);
|
|
181
|
+
const sourceFrame = targetTimelinePosition - keyframeDisplayOffset;
|
|
182
|
+
const dragOverrides = (_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {};
|
|
183
|
+
const runtimeValues = controls
|
|
184
|
+
? ((_b = runtimeValuesByStore.get(controls.runtimeValues)) !== null && _b !== void 0 ? _b : controls.runtimeValues.getSnapshot())
|
|
185
|
+
: {};
|
|
186
|
+
const activeSchema = controls
|
|
187
|
+
? (0, selected_outline_drag_1.getSelectedOutlineActiveSchema)({
|
|
188
|
+
schema: controls.schema,
|
|
189
|
+
currentRuntimeValueDotNotation: runtimeValues,
|
|
190
|
+
dragOverrides,
|
|
191
|
+
propStatus: nodePropStatuses,
|
|
192
|
+
frame: sourceFrame,
|
|
193
|
+
})
|
|
475
194
|
: null;
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const cropValues = {
|
|
503
|
-
cropLeft: getEffectiveCropValue({
|
|
504
|
-
activeSchema,
|
|
505
|
-
controls,
|
|
506
|
-
dragOverrides,
|
|
507
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.left,
|
|
508
|
-
frame: sourceFrame,
|
|
509
|
-
propStatuses: nodePropStatuses,
|
|
510
|
-
}),
|
|
511
|
-
cropRight: getEffectiveCropValue({
|
|
512
|
-
activeSchema,
|
|
513
|
-
controls,
|
|
514
|
-
dragOverrides,
|
|
515
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.right,
|
|
516
|
-
frame: sourceFrame,
|
|
517
|
-
propStatuses: nodePropStatuses,
|
|
518
|
-
}),
|
|
519
|
-
cropTop: getEffectiveCropValue({
|
|
520
|
-
activeSchema,
|
|
521
|
-
controls,
|
|
522
|
-
dragOverrides,
|
|
523
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.top,
|
|
524
|
-
frame: sourceFrame,
|
|
525
|
-
propStatuses: nodePropStatuses,
|
|
526
|
-
}),
|
|
527
|
-
cropBottom: getEffectiveCropValue({
|
|
528
|
-
activeSchema,
|
|
529
|
-
controls,
|
|
530
|
-
dragOverrides,
|
|
531
|
-
fieldKey: selected_outline_types_1.cropFieldKeys.bottom,
|
|
532
|
-
frame: sourceFrame,
|
|
533
|
-
propStatuses: nodePropStatuses,
|
|
534
|
-
}),
|
|
535
|
-
};
|
|
536
|
-
const crop = remotion_1.Internals.resolveSequenceCrop(cropValues);
|
|
537
|
-
const cropFields = getCropDragFields({
|
|
195
|
+
const cropValues = {
|
|
196
|
+
cropLeft: getEffectiveCropValue({
|
|
197
|
+
activeSchema,
|
|
198
|
+
dragOverrides,
|
|
199
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.left,
|
|
200
|
+
frame: sourceFrame,
|
|
201
|
+
propStatuses: nodePropStatuses,
|
|
202
|
+
runtimeValues,
|
|
203
|
+
}),
|
|
204
|
+
cropRight: getEffectiveCropValue({
|
|
205
|
+
activeSchema,
|
|
206
|
+
dragOverrides,
|
|
207
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.right,
|
|
208
|
+
frame: sourceFrame,
|
|
209
|
+
propStatuses: nodePropStatuses,
|
|
210
|
+
runtimeValues,
|
|
211
|
+
}),
|
|
212
|
+
cropTop: getEffectiveCropValue({
|
|
213
|
+
activeSchema,
|
|
214
|
+
dragOverrides,
|
|
215
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.top,
|
|
216
|
+
frame: sourceFrame,
|
|
217
|
+
propStatuses: nodePropStatuses,
|
|
218
|
+
runtimeValues,
|
|
219
|
+
}),
|
|
220
|
+
cropBottom: getEffectiveCropValue({
|
|
538
221
|
activeSchema,
|
|
539
|
-
|
|
222
|
+
dragOverrides,
|
|
223
|
+
fieldKey: selected_outline_types_1.cropFieldKeys.bottom,
|
|
224
|
+
frame: sourceFrame,
|
|
540
225
|
propStatuses: nodePropStatuses,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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
|
-
|
|
226
|
+
runtimeValues,
|
|
227
|
+
}),
|
|
228
|
+
};
|
|
229
|
+
const crop = remotion_1.Internals.resolveSequenceCrop(cropValues);
|
|
230
|
+
const selectedForTransformOrigin = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.sequenceKey) === key;
|
|
231
|
+
const selectedForCrop = (selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.sequenceKey) === key;
|
|
232
|
+
const selectedForUvHandles = selectedEffectsBySequenceKey.has(key);
|
|
233
|
+
const layoutTarget = {
|
|
234
|
+
key,
|
|
235
|
+
containsSelection,
|
|
236
|
+
crop,
|
|
237
|
+
keyframeDisplayOffset,
|
|
238
|
+
nodePathInfo,
|
|
239
|
+
ref: sequence.refForOutline,
|
|
240
|
+
selected,
|
|
241
|
+
selectedForCrop,
|
|
242
|
+
selectedForTransformOrigin,
|
|
243
|
+
selectedForUvHandles,
|
|
244
|
+
showSelectedOutline,
|
|
245
|
+
selection: {
|
|
246
|
+
type: 'sequence',
|
|
247
|
+
nodePathInfo: selectionNodePathInfo,
|
|
248
|
+
},
|
|
249
|
+
sequence,
|
|
250
|
+
};
|
|
251
|
+
if (mode === 'layout') {
|
|
252
|
+
return [layoutTarget];
|
|
253
|
+
}
|
|
254
|
+
const cropFields = getCropDragFields({
|
|
255
|
+
activeSchema,
|
|
256
|
+
cropValues,
|
|
257
|
+
propStatuses: nodePropStatuses,
|
|
258
|
+
});
|
|
259
|
+
const fieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.translateFieldKey];
|
|
260
|
+
const propStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.translateFieldKey];
|
|
261
|
+
const scaleFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.scaleFieldKey];
|
|
262
|
+
const scalePropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.scaleFieldKey];
|
|
263
|
+
const rotationFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.rotateFieldKey];
|
|
264
|
+
const rotationPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.rotateFieldKey];
|
|
265
|
+
const transformOriginFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.transformOriginFieldKey];
|
|
266
|
+
const transformOriginPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.transformOriginFieldKey];
|
|
267
|
+
const transformOriginValueForRotation = (transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
268
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
269
|
+
(transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed')
|
|
270
|
+
? String((_c = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
271
|
+
propStatus: transformOriginPropStatus,
|
|
272
|
+
dragOverrideValue: dragOverrides[selected_outline_types_1.transformOriginFieldKey],
|
|
273
|
+
defaultValue: transformOriginFieldSchema.default,
|
|
274
|
+
frame: sourceFrame,
|
|
275
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
276
|
+
})) !== null && _c !== void 0 ? _c : transformOriginFieldSchema.default)
|
|
277
|
+
: '50% 50%';
|
|
278
|
+
const canDragStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
279
|
+
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
280
|
+
propStatus.interpolationFunction === 'interpolate');
|
|
281
|
+
const canRotationDragStatus = (rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'static' ||
|
|
282
|
+
((rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed' &&
|
|
283
|
+
rotationPropStatus.interpolationFunction === 'interpolate');
|
|
284
|
+
const canDrag = previewInteractive &&
|
|
285
|
+
controls !== null &&
|
|
286
|
+
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
287
|
+
canDragStatus;
|
|
288
|
+
const canScaleDragStatus = (scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'static' ||
|
|
289
|
+
((scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed' &&
|
|
290
|
+
scalePropStatus.interpolationFunction === 'interpolate');
|
|
291
|
+
const canScaleDrag = previewInteractive &&
|
|
292
|
+
controls !== null &&
|
|
293
|
+
(scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale' &&
|
|
294
|
+
canScaleDragStatus;
|
|
295
|
+
const canRotationDrag = previewInteractive &&
|
|
296
|
+
controls !== null &&
|
|
297
|
+
(rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css' &&
|
|
298
|
+
canRotationDragStatus;
|
|
299
|
+
const transformOriginSourceFrame = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === null ||
|
|
300
|
+
(selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === undefined
|
|
301
|
+
? sourceFrame
|
|
302
|
+
: selectedTransformOriginInfo.displayFrame - keyframeDisplayOffset;
|
|
303
|
+
const canTransformOriginStatus = (transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
304
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed' &&
|
|
305
|
+
transformOriginPropStatus.interpolationFunction === 'interpolate');
|
|
306
|
+
const canTransformOriginTranslateStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
307
|
+
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
308
|
+
propStatus.interpolationFunction === 'interpolate');
|
|
309
|
+
const canTransformOriginDrag = previewInteractive &&
|
|
310
|
+
selectedForTransformOrigin &&
|
|
311
|
+
controls !== null &&
|
|
312
|
+
(transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
313
|
+
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
314
|
+
canTransformOriginStatus &&
|
|
315
|
+
canTransformOriginTranslateStatus;
|
|
316
|
+
const cropSourceFrame = (selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.displayFrame) === null ||
|
|
317
|
+
(selectedCropInfo === null || selectedCropInfo === void 0 ? void 0 : selectedCropInfo.displayFrame) === undefined
|
|
318
|
+
? sourceFrame
|
|
319
|
+
: selectedCropInfo.displayFrame - keyframeDisplayOffset;
|
|
320
|
+
const canCropDrag = previewInteractive &&
|
|
321
|
+
selectedForCrop &&
|
|
322
|
+
controls !== null &&
|
|
323
|
+
cropFields !== null;
|
|
324
|
+
return [
|
|
325
|
+
{
|
|
326
|
+
...layoutTarget,
|
|
612
327
|
canCrop: previewInteractive && controls !== null && cropFields !== null,
|
|
613
|
-
crop,
|
|
614
328
|
cropDrag: canCropDrag
|
|
615
329
|
? {
|
|
616
|
-
clientId:
|
|
330
|
+
clientId: connectedClientId,
|
|
617
331
|
fields: cropFields,
|
|
618
332
|
nodePath,
|
|
619
333
|
schema: controls.schema,
|
|
@@ -628,23 +342,10 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
628
342
|
: null,
|
|
629
343
|
}
|
|
630
344
|
: null,
|
|
631
|
-
containsSelection,
|
|
632
|
-
effectDrop: canDropEffect
|
|
633
|
-
? {
|
|
634
|
-
clientId: previewServerState.clientId,
|
|
635
|
-
fileName: nodePath.absolutePath,
|
|
636
|
-
nodePath,
|
|
637
|
-
}
|
|
638
|
-
: null,
|
|
639
|
-
nodePathInfo,
|
|
640
|
-
ref: sequence.refForOutline,
|
|
641
|
-
selected,
|
|
642
|
-
selection: { type: 'sequence', nodePathInfo },
|
|
643
|
-
sequence,
|
|
644
345
|
drag: canDrag
|
|
645
346
|
? {
|
|
646
347
|
propStatus,
|
|
647
|
-
clientId:
|
|
348
|
+
clientId: connectedClientId,
|
|
648
349
|
fieldDefault: fieldSchema.default,
|
|
649
350
|
keyframeDisplayOffset,
|
|
650
351
|
nodePath,
|
|
@@ -654,7 +355,7 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
654
355
|
scaleDrag: canScaleDrag
|
|
655
356
|
? {
|
|
656
357
|
propStatus: scalePropStatus,
|
|
657
|
-
clientId:
|
|
358
|
+
clientId: connectedClientId,
|
|
658
359
|
fieldDefault: scaleFieldSchema.default,
|
|
659
360
|
fieldSchema: scaleFieldSchema,
|
|
660
361
|
keyframeDisplayOffset,
|
|
@@ -680,7 +381,7 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
680
381
|
rotationDrag: canRotationDrag
|
|
681
382
|
? {
|
|
682
383
|
propStatus: rotationPropStatus,
|
|
683
|
-
clientId:
|
|
384
|
+
clientId: connectedClientId,
|
|
684
385
|
fieldDefault: rotationFieldSchema.default,
|
|
685
386
|
fieldSchema: rotationFieldSchema,
|
|
686
387
|
keyframeDisplayOffset,
|
|
@@ -691,21 +392,21 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
691
392
|
: null,
|
|
692
393
|
transformOriginDrag: canTransformOriginDrag
|
|
693
394
|
? {
|
|
694
|
-
clientId:
|
|
395
|
+
clientId: connectedClientId,
|
|
695
396
|
keyframeDisplayOffset,
|
|
696
397
|
nodePath,
|
|
697
398
|
originDefault: transformOriginFieldSchema.default,
|
|
698
399
|
originPropStatus: transformOriginPropStatus,
|
|
699
|
-
originValue: String((
|
|
400
|
+
originValue: String((_d = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
700
401
|
propStatus: transformOriginPropStatus,
|
|
701
402
|
dragOverrideValue: dragOverrides[selected_outline_types_1.transformOriginFieldKey],
|
|
702
403
|
defaultValue: transformOriginFieldSchema.default,
|
|
703
404
|
frame: transformOriginSourceFrame,
|
|
704
405
|
shouldResortToDefaultValueIfUndefined: true,
|
|
705
|
-
})) !== null &&
|
|
406
|
+
})) !== null && _d !== void 0 ? _d : transformOriginFieldSchema.default),
|
|
706
407
|
rotateValue: String((rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'static' ||
|
|
707
408
|
(rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed'
|
|
708
|
-
? ((
|
|
409
|
+
? ((_e = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
709
410
|
propStatus: rotationPropStatus,
|
|
710
411
|
dragOverrideValue: dragOverrides[selected_outline_types_1.rotateFieldKey],
|
|
711
412
|
defaultValue: (rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css'
|
|
@@ -713,11 +414,11 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
713
414
|
: '0deg',
|
|
714
415
|
frame: transformOriginSourceFrame,
|
|
715
416
|
shouldResortToDefaultValueIfUndefined: true,
|
|
716
|
-
})) !== null &&
|
|
417
|
+
})) !== null && _e !== void 0 ? _e : '0deg')
|
|
717
418
|
: '0deg'),
|
|
718
419
|
scaleValue: (scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'static' ||
|
|
719
420
|
(scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed'
|
|
720
|
-
? String((
|
|
421
|
+
? String((_f = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
721
422
|
propStatus: scalePropStatus,
|
|
722
423
|
dragOverrideValue: dragOverrides[selected_outline_types_1.scaleFieldKey],
|
|
723
424
|
defaultValue: (scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale'
|
|
@@ -725,367 +426,194 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
|
|
|
725
426
|
: 1,
|
|
726
427
|
frame: transformOriginSourceFrame,
|
|
727
428
|
shouldResortToDefaultValueIfUndefined: true,
|
|
728
|
-
})) !== null &&
|
|
429
|
+
})) !== null && _f !== void 0 ? _f : 1)
|
|
729
430
|
: '1',
|
|
730
431
|
schema: controls.schema,
|
|
731
432
|
sourceFrame: transformOriginSourceFrame,
|
|
732
433
|
translateDefault: fieldSchema.default,
|
|
733
434
|
translatePropStatus: propStatus,
|
|
734
|
-
translateValue: String((
|
|
435
|
+
translateValue: String((_g = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
735
436
|
propStatus,
|
|
736
437
|
dragOverrideValue: dragOverrides[selected_outline_types_1.translateFieldKey],
|
|
737
438
|
defaultValue: fieldSchema.default,
|
|
738
439
|
frame: transformOriginSourceFrame,
|
|
739
440
|
shouldResortToDefaultValueIfUndefined: true,
|
|
740
|
-
})) !== null &&
|
|
441
|
+
})) !== null && _g !== void 0 ? _g : fieldSchema.default),
|
|
741
442
|
}
|
|
742
443
|
: null,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
444
|
+
},
|
|
445
|
+
];
|
|
446
|
+
});
|
|
447
|
+
};
|
|
448
|
+
const ActiveSelectedOutlineOverlayUnmemoized = ({ calculateOutlineTargetsForCurrentState, compositionHeight, compositionWidth, draggingOutline, getLatestOutlineTargetByKey, getSelectableOutlines, onDraggingChange, onSelect, scale, selectedSequenceKeys, sequenceKeysContainingSelection, sequences, translationX, translationY, }) => {
|
|
449
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
450
|
+
const updateOutlinesRef = (0, react_1.useRef)(() => undefined);
|
|
451
|
+
const selectableOutlines = (0, react_1.useMemo)(() => {
|
|
452
|
+
return getSelectableOutlines(timelinePosition);
|
|
453
|
+
}, [getSelectableOutlines, timelinePosition]);
|
|
454
|
+
const outlineRuntimeControls = (0, react_1.useMemo)(() => {
|
|
455
|
+
return selectableOutlines.flatMap(({ key, sequence }) => {
|
|
456
|
+
if (!selectedSequenceKeys.has(key) &&
|
|
457
|
+
!sequenceKeysContainingSelection.has(key)) {
|
|
458
|
+
return [];
|
|
459
|
+
}
|
|
460
|
+
return sequence.controls ? [sequence.controls] : [];
|
|
755
461
|
});
|
|
756
462
|
}, [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
463
|
+
selectableOutlines,
|
|
464
|
+
selectedSequenceKeys,
|
|
465
|
+
sequenceKeysContainingSelection,
|
|
466
|
+
]);
|
|
467
|
+
const outlineRuntimeSnapshots = (0, use_runtime_values_1.useRuntimeValueSnapshots)(outlineRuntimeControls);
|
|
468
|
+
const outlineRuntimeValuesByStore = (0, react_1.useMemo)(() => new Map(outlineRuntimeControls.map((controls, index) => [
|
|
469
|
+
controls.runtimeValues,
|
|
470
|
+
outlineRuntimeSnapshots[index],
|
|
471
|
+
])), [outlineRuntimeControls, outlineRuntimeSnapshots]);
|
|
472
|
+
const outlineTargets = (0, react_1.useMemo)(() => calculateOutlineTargetsForCurrentState({
|
|
473
|
+
mode: 'layout',
|
|
474
|
+
runtimeValuesByStore: outlineRuntimeValuesByStore,
|
|
475
|
+
selectableOutlines,
|
|
476
|
+
targetKey: null,
|
|
477
|
+
targetTimelinePosition: timelinePosition,
|
|
478
|
+
}), [
|
|
479
|
+
calculateOutlineTargetsForCurrentState,
|
|
480
|
+
outlineRuntimeValuesByStore,
|
|
481
|
+
selectableOutlines,
|
|
770
482
|
timelinePosition,
|
|
771
483
|
]);
|
|
772
|
-
(0, react_1.
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}, [
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
},
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
? [target.rotationDrag]
|
|
808
|
-
: []);
|
|
809
|
-
}, [outlineTargets]);
|
|
810
|
-
const guidesForSnap = (0, react_1.useMemo)(() => {
|
|
811
|
-
if (!editorShowGuides || (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) !== 'composition') {
|
|
484
|
+
const outlineTargetsRef = (0, react_1.useRef)(outlineTargets);
|
|
485
|
+
const getOutlineTargets = (0, react_1.useCallback)(() => outlineTargetsRef.current, []);
|
|
486
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
487
|
+
outlineTargetsRef.current = outlineTargets;
|
|
488
|
+
updateOutlinesRef.current();
|
|
489
|
+
}, [outlineTargets, scale, translationX, translationY]);
|
|
490
|
+
return (jsx_runtime_1.jsx(SelectedOutlineRenderer_1.SelectedOutlineRenderer, { compositionHeight: compositionHeight, compositionWidth: compositionWidth, dragging: draggingOutline, getLatestOutlineTargetByKey: getLatestOutlineTargetByKey, getOutlineTargets: getOutlineTargets, onDraggingChange: onDraggingChange, onSelect: onSelect, scale: scale, sequences: sequences, updateOutlinesRef: updateOutlinesRef }));
|
|
491
|
+
};
|
|
492
|
+
const ActiveSelectedOutlineOverlay = react_1.default.memo(ActiveSelectedOutlineOverlayUnmemoized);
|
|
493
|
+
const SelectedOutlineOverlayUnmemoized = ({ canvasHovered, compositionHeight, compositionWidth, scale, translationX, translationY, }) => {
|
|
494
|
+
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
495
|
+
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
496
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
497
|
+
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
498
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
499
|
+
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
500
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
501
|
+
const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
502
|
+
const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
503
|
+
const setHoveredSequence = (0, timeline_sequence_hover_1.useSetTimelineSequenceHover)();
|
|
504
|
+
const hoveredSequence = (0, timeline_sequence_hover_1.useTimelineSequenceHoverState)();
|
|
505
|
+
const isFullscreen = (0, use_is_fullscreen_1.useIsFullscreen)();
|
|
506
|
+
const { getCurrentFrame } = player_1.PlayerInternals.usePlayerMethods();
|
|
507
|
+
const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
|
|
508
|
+
const previewSelectionAvailable = previewServerState.type === 'connected' || window.remotion_isReadOnlyStudio;
|
|
509
|
+
const selectedSequenceKeys = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedSequenceKeys)(selectedItems), [selectedItems]);
|
|
510
|
+
const sequenceKeysContainingSelection = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSequenceKeysContainingSelection)(selectedItems), [selectedItems]);
|
|
511
|
+
const selectedEffectsBySequenceKey = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedEffectFieldsBySequenceKey)(selectedItems), [selectedItems]);
|
|
512
|
+
const selectedTransformOriginInfo = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedTransformOriginInfo)(selectedItems), [selectedItems]);
|
|
513
|
+
const selectedCropInfo = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedCropInfo)(selectedItems), [selectedItems]);
|
|
514
|
+
const getSelectableOutlines = (0, react_1.useCallback)((timelinePosition) => {
|
|
515
|
+
if (isFullscreen ||
|
|
516
|
+
!(0, interactivity_enabled_1.isStudioSelectionEnabled)() ||
|
|
517
|
+
!previewSelectionAvailable ||
|
|
518
|
+
!editorShowOutlines) {
|
|
812
519
|
return [];
|
|
813
520
|
}
|
|
814
|
-
return
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
compositionWidth,
|
|
820
|
-
guides: guidesForSnap,
|
|
821
|
-
});
|
|
822
|
-
}, [compositionHeight, compositionWidth, guidesForSnap]);
|
|
823
|
-
const saveKeyboardNudgeSession = (0, react_1.useCallback)(() => {
|
|
824
|
-
const session = keyboardNudgeSessionRef.current;
|
|
825
|
-
if (session === null) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
keyboardNudgeSessionRef.current = null;
|
|
829
|
-
const changes = (0, selected_outline_drag_1.getSelectedOutlineDragChanges)({
|
|
830
|
-
dragStates: session.dragStates,
|
|
831
|
-
lastValues: session.lastValues,
|
|
832
|
-
});
|
|
833
|
-
if (changes.length === 0) {
|
|
834
|
-
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
835
|
-
clearDragOverrides,
|
|
836
|
-
dragStates: session.dragStates,
|
|
837
|
-
});
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
841
|
-
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
842
|
-
Promise.all([
|
|
843
|
-
staticChanges.length > 0
|
|
844
|
-
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
845
|
-
changes: staticChanges,
|
|
846
|
-
addedKeyframes: null,
|
|
847
|
-
movedKeyframes: null,
|
|
848
|
-
setPropStatuses,
|
|
849
|
-
clientId: session.clientId,
|
|
850
|
-
undoLabel: changes.length > 1 ? 'Move selected sequences' : 'Move sequence',
|
|
851
|
-
redoLabel: changes.length > 1
|
|
852
|
-
? 'Move selected sequences back'
|
|
853
|
-
: 'Move sequence back',
|
|
854
|
-
})
|
|
855
|
-
: Promise.resolve(),
|
|
856
|
-
(0, call_add_keyframe_1.callAddKeyframes)({
|
|
857
|
-
sequenceKeyframes: keyframedChanges,
|
|
858
|
-
effectKeyframes: [],
|
|
859
|
-
setPropStatuses,
|
|
860
|
-
clientId: session.clientId,
|
|
861
|
-
}),
|
|
862
|
-
])
|
|
863
|
-
.catch((err) => {
|
|
864
|
-
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
865
|
-
})
|
|
866
|
-
.finally(() => {
|
|
867
|
-
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
868
|
-
clearDragOverrides,
|
|
869
|
-
dragStates: session.dragStates,
|
|
870
|
-
});
|
|
871
|
-
});
|
|
872
|
-
}, [clearDragOverrides, setPropStatuses]);
|
|
873
|
-
(0, react_1.useEffect)(() => {
|
|
874
|
-
saveKeyboardNudgeSessionRef.current = saveKeyboardNudgeSession;
|
|
875
|
-
}, [saveKeyboardNudgeSession]);
|
|
876
|
-
(0, react_1.useEffect)(() => {
|
|
877
|
-
return () => {
|
|
878
|
-
saveKeyboardNudgeSessionRef.current();
|
|
879
|
-
};
|
|
880
|
-
}, []);
|
|
881
|
-
const seekWithArrowKey = (0, react_1.useCallback)((event, direction) => {
|
|
882
|
-
if (direction === 'up' || direction === 'down') {
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
event.preventDefault();
|
|
886
|
-
if (direction === 'left') {
|
|
887
|
-
if (event.altKey) {
|
|
888
|
-
seek(0);
|
|
889
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
890
|
-
direction: 'fit-left',
|
|
891
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
892
|
-
frame: 0,
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
else if (event.shiftKey) {
|
|
896
|
-
frameBack((0, imperative_state_1.getCurrentFps)());
|
|
897
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
898
|
-
direction: 'fit-left',
|
|
899
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
900
|
-
frame: Math.max(0, getCurrentFrame() - (0, imperative_state_1.getCurrentFps)()),
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
else {
|
|
904
|
-
frameBack(1);
|
|
905
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
906
|
-
direction: 'fit-left',
|
|
907
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
908
|
-
frame: Math.max(0, getCurrentFrame() - 1),
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
return;
|
|
912
|
-
}
|
|
913
|
-
if (event.altKey) {
|
|
914
|
-
seek((0, imperative_state_1.getCurrentDuration)() - 1);
|
|
915
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
916
|
-
direction: 'fit-right',
|
|
917
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
918
|
-
frame: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
else if (event.shiftKey) {
|
|
922
|
-
frameForward((0, imperative_state_1.getCurrentFps)());
|
|
923
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
924
|
-
direction: 'fit-right',
|
|
925
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
926
|
-
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + (0, imperative_state_1.getCurrentFps)()),
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
frameForward(1);
|
|
931
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
932
|
-
direction: 'fit-right',
|
|
933
|
-
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
934
|
-
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + 1),
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
}, [frameBack, frameForward, getCurrentFrame, seek]);
|
|
938
|
-
const onArrowKeyDown = (0, react_1.useCallback)((event) => {
|
|
939
|
-
var _a;
|
|
940
|
-
const direction = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDirection)(event.key);
|
|
941
|
-
if (direction === null) {
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
if (selectedItems.length === 0 || allDragTargets.length === 0) {
|
|
945
|
-
seekWithArrowKey(event, direction);
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
if (event.altKey) {
|
|
949
|
-
seekWithArrowKey(event, direction);
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
event.preventDefault();
|
|
953
|
-
const activeSession = (_a = keyboardNudgeSessionRef.current) !== null && _a !== void 0 ? _a : (() => {
|
|
954
|
-
const [firstDragTarget] = allDragTargets;
|
|
955
|
-
if (firstDragTarget === undefined) {
|
|
956
|
-
throw new Error('Expected a drag target');
|
|
957
|
-
}
|
|
958
|
-
return {
|
|
959
|
-
clientId: firstDragTarget.clientId,
|
|
960
|
-
deltaX: 0,
|
|
961
|
-
deltaY: 0,
|
|
962
|
-
dragStates: (0, selected_outline_drag_1.getSelectedOutlineDragStates)({
|
|
963
|
-
dragTargets: allDragTargets,
|
|
964
|
-
getDragOverrides,
|
|
965
|
-
timelinePosition,
|
|
966
|
-
}),
|
|
967
|
-
lastValues: new Map(),
|
|
968
|
-
};
|
|
969
|
-
})();
|
|
970
|
-
keyboardNudgeSessionRef.current = activeSession;
|
|
971
|
-
const nextDeltas = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDeltas)({
|
|
972
|
-
deltaX: activeSession.deltaX,
|
|
973
|
-
deltaY: activeSession.deltaY,
|
|
974
|
-
direction,
|
|
975
|
-
shiftKey: event.shiftKey,
|
|
976
|
-
});
|
|
977
|
-
activeSession.deltaX = nextDeltas.deltaX;
|
|
978
|
-
activeSession.deltaY = nextDeltas.deltaY;
|
|
979
|
-
const lastValues = (0, selected_outline_drag_1.getSelectedOutlineDragValues)({
|
|
980
|
-
dragStates: activeSession.dragStates,
|
|
981
|
-
deltaX: activeSession.deltaX,
|
|
982
|
-
deltaY: activeSession.deltaY,
|
|
521
|
+
return (0, selected_outline_measurement_1.getSequencesWithSelectableOutlines)({
|
|
522
|
+
sequences,
|
|
523
|
+
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
524
|
+
compositions,
|
|
525
|
+
timelinePosition,
|
|
983
526
|
});
|
|
984
|
-
activeSession.lastValues = lastValues;
|
|
985
|
-
for (const dragState of activeSession.dragStates) {
|
|
986
|
-
const value = lastValues.get(dragState.key);
|
|
987
|
-
if (value === undefined) {
|
|
988
|
-
throw new Error('Expected drag value to be available');
|
|
989
|
-
}
|
|
990
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
991
|
-
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
992
|
-
status: dragState.target.propStatus,
|
|
993
|
-
frame: dragState.sourceFrame,
|
|
994
|
-
value,
|
|
995
|
-
}));
|
|
996
|
-
}
|
|
997
|
-
else {
|
|
998
|
-
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
527
|
}, [
|
|
1002
|
-
|
|
528
|
+
compositions,
|
|
529
|
+
editorShowOutlines,
|
|
530
|
+
isFullscreen,
|
|
531
|
+
overrideIdToNodePathMappings,
|
|
532
|
+
previewSelectionAvailable,
|
|
533
|
+
sequences,
|
|
534
|
+
]);
|
|
535
|
+
const calculateOutlineTargetsForCurrentState = (0, react_1.useCallback)((options) => calculateOutlineTargets({
|
|
536
|
+
...options,
|
|
537
|
+
connectedClientId: previewServerState.type === 'connected'
|
|
538
|
+
? previewServerState.clientId
|
|
539
|
+
: null,
|
|
540
|
+
editorShowOutlines,
|
|
1003
541
|
getDragOverrides,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
542
|
+
getScaleLockState,
|
|
543
|
+
isFullscreen,
|
|
544
|
+
previewSelectionAvailable,
|
|
545
|
+
propStatuses,
|
|
546
|
+
selectedCropInfo,
|
|
547
|
+
selectedEffectsBySequenceKey,
|
|
548
|
+
selectedSequenceKeys,
|
|
549
|
+
selectedTransformOriginInfo,
|
|
550
|
+
sequenceKeysContainingSelection,
|
|
551
|
+
studioInteractivityEnabled: (0, interactivity_enabled_1.isStudioInteractivityEnabled)(),
|
|
552
|
+
}), [
|
|
553
|
+
editorShowOutlines,
|
|
554
|
+
getDragOverrides,
|
|
555
|
+
getScaleLockState,
|
|
556
|
+
isFullscreen,
|
|
557
|
+
previewSelectionAvailable,
|
|
558
|
+
previewServerState,
|
|
559
|
+
propStatuses,
|
|
560
|
+
selectedCropInfo,
|
|
561
|
+
selectedEffectsBySequenceKey,
|
|
562
|
+
selectedSequenceKeys,
|
|
563
|
+
selectedTransformOriginInfo,
|
|
564
|
+
sequenceKeysContainingSelection,
|
|
1008
565
|
]);
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
event: 'keyup',
|
|
1029
|
-
key,
|
|
1030
|
-
callback: onArrowKeyUp,
|
|
1031
|
-
commandCtrlKey: false,
|
|
1032
|
-
preventDefault: false,
|
|
1033
|
-
triggerIfInputFieldFocused: false,
|
|
1034
|
-
keepRegisteredWhenNotHighestContext: false,
|
|
1035
|
-
}));
|
|
1036
|
-
return () => {
|
|
1037
|
-
for (const binding of [...keyDownBindings, ...keyUpBindings]) {
|
|
1038
|
-
binding.unregister();
|
|
1039
|
-
}
|
|
566
|
+
const calculateOutlineTargetsRef = (0, react_1.useRef)(calculateOutlineTargetsForCurrentState);
|
|
567
|
+
const getSelectableOutlinesRef = (0, react_1.useRef)(getSelectableOutlines);
|
|
568
|
+
const selectableOutlinesCacheRef = (0, react_1.useRef)(null);
|
|
569
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
570
|
+
calculateOutlineTargetsRef.current = calculateOutlineTargetsForCurrentState;
|
|
571
|
+
getSelectableOutlinesRef.current = getSelectableOutlines;
|
|
572
|
+
}, [calculateOutlineTargetsForCurrentState, getSelectableOutlines]);
|
|
573
|
+
const getSelectableOutlinesAtFrame = (0, react_1.useCallback)((timelinePosition) => {
|
|
574
|
+
const currentGetSelectableOutlines = getSelectableOutlinesRef.current;
|
|
575
|
+
const cached = selectableOutlinesCacheRef.current;
|
|
576
|
+
if ((cached === null || cached === void 0 ? void 0 : cached.timelinePosition) === timelinePosition &&
|
|
577
|
+
cached.getSelectableOutlines === currentGetSelectableOutlines) {
|
|
578
|
+
return cached.selectableOutlines;
|
|
579
|
+
}
|
|
580
|
+
const selectableOutlines = currentGetSelectableOutlines(timelinePosition);
|
|
581
|
+
selectableOutlinesCacheRef.current = {
|
|
582
|
+
getSelectableOutlines: currentGetSelectableOutlines,
|
|
583
|
+
selectableOutlines,
|
|
584
|
+
timelinePosition,
|
|
1040
585
|
};
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
586
|
+
return selectableOutlines;
|
|
587
|
+
}, []);
|
|
588
|
+
const getLatestOutlineTargetByKey = (0, react_1.useCallback)((key) => {
|
|
589
|
+
const timelinePosition = getCurrentFrame();
|
|
590
|
+
const target = calculateOutlineTargetsRef.current({
|
|
591
|
+
mode: 'controls',
|
|
592
|
+
runtimeValuesByStore: new Map(),
|
|
593
|
+
selectableOutlines: getSelectableOutlinesAtFrame(timelinePosition),
|
|
594
|
+
targetKey: key,
|
|
595
|
+
targetTimelinePosition: timelinePosition,
|
|
596
|
+
})[0];
|
|
597
|
+
return target;
|
|
598
|
+
}, [getCurrentFrame, getSelectableOutlinesAtFrame]);
|
|
599
|
+
const getCurrentSelectableOutlines = (0, react_1.useCallback)(() => getSelectableOutlinesAtFrame(getCurrentFrame()), [getCurrentFrame, getSelectableOutlinesAtFrame]);
|
|
600
|
+
const onDraggingChange = (0, react_1.useCallback)((dragging) => {
|
|
601
|
+
setDraggingOutline(dragging);
|
|
602
|
+
if (dragging) {
|
|
603
|
+
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
1046
604
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
1053
|
-
updateOutlines();
|
|
1054
|
-
}, [outlineTargets, scale, translationX, translationY, updateOutlines]);
|
|
605
|
+
}, [setHoveredSequence]);
|
|
606
|
+
const selectOutlineItem = (0, react_1.useCallback)((item, interaction) => {
|
|
607
|
+
selectItem(item, interaction, undefined, { reveal: true });
|
|
608
|
+
}, [selectItem]);
|
|
609
|
+
const measurementActive = canvasHovered || draggingOutline || (hoveredSequence === null || hoveredSequence === void 0 ? void 0 : hoveredSequence.source) === 'timeline';
|
|
1055
610
|
(0, react_1.useLayoutEffect)(() => {
|
|
1056
|
-
if (
|
|
611
|
+
if (measurementActive) {
|
|
1057
612
|
return;
|
|
1058
613
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
}
|
|
1064
|
-
animationFrame = requestAnimationFrame(() => {
|
|
1065
|
-
animationFrame = null;
|
|
1066
|
-
updateOutlines();
|
|
1067
|
-
});
|
|
1068
|
-
};
|
|
1069
|
-
const resizeObserver = new ResizeObserver(scheduleUpdate);
|
|
1070
|
-
if (overlayRef.current !== null) {
|
|
1071
|
-
resizeObserver.observe(overlayRef.current);
|
|
1072
|
-
}
|
|
1073
|
-
for (const target of outlineTargets) {
|
|
1074
|
-
if (target.ref.current !== null) {
|
|
1075
|
-
resizeObserver.observe(target.ref.current);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
return () => {
|
|
1079
|
-
if (animationFrame !== null) {
|
|
1080
|
-
cancelAnimationFrame(animationFrame);
|
|
1081
|
-
}
|
|
1082
|
-
resizeObserver.disconnect();
|
|
1083
|
-
};
|
|
1084
|
-
}, [outlineTargets, updateOutlines]);
|
|
1085
|
-
if (outlineTargets.length === 0) {
|
|
1086
|
-
return null;
|
|
1087
|
-
}
|
|
1088
|
-
return (jsx_runtime_1.jsxs("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: [
|
|
1089
|
-
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`)))] }));
|
|
614
|
+
setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
|
|
615
|
+
}, [measurementActive, setHoveredSequence]);
|
|
616
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
617
|
+
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, onSelect: selectOutlineItem, scale: scale, selectedSequenceKeys: selectedSequenceKeys, sequenceKeysContainingSelection: sequenceKeysContainingSelection, sequences: sequences, translationX: translationX, translationY: translationY })) : null] }));
|
|
1090
618
|
};
|
|
1091
|
-
exports.SelectedOutlineOverlay =
|
|
619
|
+
exports.SelectedOutlineOverlay = react_1.default.memo(SelectedOutlineOverlayUnmemoized);
|