@remotion/studio 4.0.526 → 4.0.528
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/components/AgentPrompt.js +1 -2
- package/dist/components/AudioWaveform.d.ts +1 -0
- package/dist/components/AudioWaveform.js +10 -14
- package/dist/components/Canvas.js +88 -26
- package/dist/components/CanvasCaptureDropHandler.js +63 -0
- package/dist/components/CanvasOrLoading.js +10 -2
- package/dist/components/CodeFrame.js +1 -1
- package/dist/components/ColorPicker/checker.d.ts +1 -1
- package/dist/components/CompositionSelectorItem.js +1 -0
- package/dist/components/CurrentAsset.js +4 -2
- package/dist/components/EditorRuler/Ruler.js +6 -3
- package/dist/components/EffectPickerModal.js +69 -43
- package/dist/components/ElementInstallConfirmation.js +3 -3
- package/dist/components/ElementLibrariesSettings.d.ts +2 -0
- package/dist/components/ElementLibrariesSettings.js +200 -0
- package/dist/components/InitialCompositionLoader.js +4 -2
- package/dist/components/InlineDropdown.js +26 -2
- package/dist/components/InlineEditableTitle.js +1 -0
- package/dist/components/InspectorOpenInEditor.js +13 -0
- package/dist/components/InspectorPanel/AlignmentControls.js +28 -9
- package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +2 -1
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -3
- package/dist/components/InspectorPanel/CompositionMetadata.js +4 -0
- package/dist/components/InspectorPanel/EasingInspector.js +6 -2
- package/dist/components/InspectorPanel/ElementLibraryButton.js +2 -1
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +1 -1
- package/dist/components/InspectorPanel/KeyframeInspector.js +28 -24
- package/dist/components/InspectorPanel/MultiSequenceInspector.js +32 -1
- package/dist/components/InspectorPanel/MultiSequenceNumberField.js +1 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -1
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +70 -2
- package/dist/components/InspectorPanel/SequenceWrapAction.d.ts +8 -0
- package/dist/components/InspectorPanel/SequenceWrapAction.js +151 -0
- package/dist/components/InspectorPanel/common.js +1 -0
- package/dist/components/InspectorPanel/easing-inspector-selection.d.ts +2 -1
- package/dist/components/InspectorPanel/easing-inspector-selection.js +4 -3
- package/dist/components/InspectorPanel/keyframe-inspector-frame.d.ts +2 -1
- package/dist/components/InspectorPanel/keyframe-inspector-frame.js +2 -2
- package/dist/components/InspectorPanel/styles.js +2 -0
- package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
- package/dist/components/InspectorSequenceSection.d.ts +1 -0
- package/dist/components/InspectorSequenceSection.js +7 -5
- package/dist/components/InspectorSourceLocation.js +3 -0
- package/dist/components/KeyboardShortcutsSettings.js +1 -1
- package/dist/components/Menu/styles.d.ts +2 -2
- package/dist/components/MenuBuildIndicator.js +1 -0
- package/dist/components/Modals.js +7 -6
- package/dist/components/ModelManager.js +10 -9
- package/dist/components/NewComposition/CancelButton.js +11 -5
- package/dist/components/NewComposition/InputDragger.d.ts +3 -1
- package/dist/components/NewComposition/InputDragger.js +28 -9
- package/dist/components/NewComposition/NewComposition.js +7 -6
- package/dist/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/components/NewComposition/menu-typeahead.js +1 -1
- package/dist/components/Preview.js +4 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -0
- package/dist/components/RadioButton.js +1 -0
- package/dist/components/RenderModal/DataEditor.js +4 -1
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +1 -2
- package/dist/components/RenderModal/WebRenderModalPicture.js +1 -2
- package/dist/components/RenderQueue/CaptionQueueItem.js +19 -7
- package/dist/components/RenderQueue/CaptionQueueProcessor.js +65 -15
- package/dist/components/RenderQueue/QueueJobError.d.ts +8 -0
- package/dist/components/RenderQueue/QueueJobError.js +24 -0
- package/dist/components/RenderQueue/QueueJobErrorModal.d.ts +8 -0
- package/dist/components/RenderQueue/QueueJobErrorModal.js +63 -0
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.d.ts +3 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +11 -4
- package/dist/components/RenderQueue/RenderQueueRepeat.d.ts +3 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +20 -3
- package/dist/components/RenderQueue/VideoMattingQueueItem.js +25 -27
- package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +68 -28
- package/dist/components/RenderQueue/caption-job-types.d.ts +9 -1
- package/dist/components/RenderQueue/context.d.ts +4 -0
- package/dist/components/RenderQueue/context.js +58 -8
- package/dist/components/RenderQueue/index.js +3 -3
- package/dist/components/RenderQueue/load-model-for-job.d.ts +2 -1
- package/dist/components/RenderQueue/load-model-for-job.js +5 -1
- package/dist/components/RenderQueue/video-matting-job-types.d.ts +13 -6
- package/dist/components/RendersTab.js +2 -0
- package/dist/components/SelectedOutlineCropControls.js +2 -1
- package/dist/components/SelectedOutlineEditingHandles.js +9 -2
- package/dist/components/SelectedOutlineElement.js +9 -3
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -4
- package/dist/components/SelectedOutlineKeyboardControls.js +4 -22
- package/dist/components/SelectedOutlineOverlay.js +152 -106
- package/dist/components/SelectedOutlinePathPoints.d.ts +8 -0
- package/dist/components/SelectedOutlinePathPoints.js +433 -0
- package/dist/components/SelectedOutlinePolygon.js +21 -46
- package/dist/components/SelectedOutlineRenderer.d.ts +3 -5
- package/dist/components/SelectedOutlineRenderer.js +32 -136
- package/dist/components/SelectedOutlineSnapIndicators.d.ts +6 -0
- package/dist/components/SelectedOutlineSnapIndicators.js +16 -12
- package/dist/components/SelectedOutlineTransformOriginHandle.js +3 -2
- package/dist/components/SelectedOutlineUvControls.js +12 -7
- package/dist/components/SequencePropsSubscriptionProvider.d.ts +3 -0
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -6
- package/dist/components/SettingsModal.js +30 -3
- package/dist/components/SettingsModalFooter.d.ts +1 -0
- package/dist/components/SettingsModalFooter.js +7 -3
- package/dist/components/ShowOutlinesProvider.js +1 -1
- package/dist/components/SkillsSettings.d.ts +0 -1
- package/dist/components/SkillsSettings.js +13 -14
- package/dist/components/Splitter/SplitterElement.js +1 -2
- package/dist/components/TimeValue.js +1 -1
- package/dist/components/Timeline/LoopedTimelineIndicators.d.ts +1 -0
- package/dist/components/Timeline/LoopedTimelineIndicators.js +7 -6
- package/dist/components/Timeline/TimelineArrayField.js +1 -1
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +0 -1
- package/dist/components/Timeline/TimelineColorField.js +1 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +6 -9
- package/dist/components/Timeline/TimelineDragHandler.js +1 -1
- package/dist/components/Timeline/TimelineEffectItem.js +1 -0
- package/dist/components/Timeline/TimelineEffectPropItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineEffectPropItem.js +12 -5
- package/dist/components/Timeline/TimelineExpandArrowButton.js +1 -0
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedRow.js +6 -4
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedSection.js +2 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +3 -1
- package/dist/components/Timeline/TimelineFieldLabel.js +1 -0
- package/dist/components/Timeline/TimelineFontFamilyField.js +12 -12
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +1 -0
- package/dist/components/Timeline/TimelineKeyframeControls.js +40 -28
- package/dist/components/Timeline/TimelineLayerChildren.js +1 -1
- package/dist/components/Timeline/TimelineList.js +1 -1
- package/dist/components/Timeline/TimelineNumberField.js +2 -4
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
- package/dist/components/Timeline/TimelineSelection.d.ts +9 -9
- package/dist/components/Timeline/TimelineSelection.js +16 -9
- package/dist/components/Timeline/TimelineSequence.d.ts +3 -1
- package/dist/components/Timeline/TimelineSequence.js +65 -21
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +46 -8
- package/dist/components/Timeline/TimelineSequencePropItem.d.ts +3 -0
- package/dist/components/Timeline/TimelineSequencePropItem.js +262 -25
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +11 -13
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +98 -77
- package/dist/components/Timeline/TimelineTextContentField.js +27 -4
- package/dist/components/Timeline/TimelineTimeIndicators.js +10 -5
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTrimTooltip.d.ts +11 -0
- package/dist/components/Timeline/TimelineTrimTooltip.js +41 -0
- package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
- package/dist/components/Timeline/TimelineVideoInfo.js +13 -10
- package/dist/components/Timeline/TimelineViewport.d.ts +1 -0
- package/dist/components/Timeline/TimelineViewport.js +10 -1
- package/dist/components/Timeline/delete-selected-keyframe.js +22 -8
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +1 -5
- package/dist/components/Timeline/delete-selected-timeline-item.js +9 -95
- package/dist/components/Timeline/get-animation-item-selection-for-frame.d.ts +2 -1
- package/dist/components/Timeline/get-animation-item-selection-for-frame.js +7 -5
- package/dist/components/Timeline/get-keyframed-sequence-drag-targets.d.ts +23 -0
- package/dist/components/Timeline/get-keyframed-sequence-drag-targets.js +57 -0
- package/dist/components/Timeline/get-node-keyframes.d.ts +2 -1
- package/dist/components/Timeline/get-node-keyframes.js +6 -4
- package/dist/components/Timeline/get-playback-rate-keyframe-changes.d.ts +21 -0
- package/dist/components/Timeline/get-playback-rate-keyframe-changes.js +142 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +3 -1
- package/dist/components/Timeline/get-sequence-context-menu-items.js +13 -1
- package/dist/components/Timeline/get-timeline-keyframes.d.ts +15 -2
- package/dist/components/Timeline/get-timeline-keyframes.js +44 -6
- package/dist/components/Timeline/keyframe-clipboard.js +17 -3
- package/dist/components/Timeline/split-selected-timeline-item.d.ts +13 -10
- package/dist/components/Timeline/split-selected-timeline-item.js +61 -35
- package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +1 -0
- package/dist/components/Timeline/use-delete-timeline-items.js +17 -11
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +2 -1
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +3 -1
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +7 -3
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +28 -19
- package/dist/components/TimelineCombobox.js +1 -0
- package/dist/components/Transcription/Models.js +1 -1
- package/dist/components/Transcription/TranscriptionModal.js +18 -11
- package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +1 -1
- package/dist/components/Transcription/resample-media-to-16-khz.d.ts +2 -1
- package/dist/components/Transcription/resample-media-to-16-khz.js +20 -2
- package/dist/components/UpdatesSettings.js +2 -0
- package/dist/components/VideoMatting/Models.js +1 -1
- package/dist/components/VideoMatting/VideoMattingModal.js +30 -47
- package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +1 -1
- package/dist/components/WebMcp.js +23 -40
- package/dist/components/composition-drop-preview.d.ts +9 -2
- package/dist/components/composition-drop-preview.js +8 -4
- package/dist/components/composition-menu-items.js +4 -4
- package/dist/components/delete-jsx-nodes-api.d.ts +2 -0
- package/dist/components/{delete-jsx-node-api.js → delete-jsx-nodes-api.js} +5 -5
- package/dist/components/effect-drag-and-drop.d.ts +13 -5
- package/dist/components/effect-drag-and-drop.js +19 -4
- package/dist/components/get-open-in-menu-items.d.ts +2 -1
- package/dist/components/get-open-in-menu-items.js +24 -8
- package/dist/components/keyboard-shortcuts.d.ts +4 -4
- package/dist/components/keyboard-shortcuts.js +3 -1
- package/dist/components/public-output-name.d.ts +1 -0
- package/dist/components/public-output-name.js +7 -3
- package/dist/components/selected-outline-drag.d.ts +1 -6
- package/dist/components/selected-outline-drag.js +22 -6
- package/dist/components/selected-outline-geometry.d.ts +2 -18
- package/dist/components/selected-outline-measurement.d.ts +23 -41
- package/dist/components/selected-outline-measurement.js +14 -252
- package/dist/components/selected-outline-order.d.ts +4 -11
- package/dist/components/selected-outline-order.js +2 -254
- package/dist/components/selected-outline-snap.d.ts +1 -1
- package/dist/components/selected-outline-snap.js +2 -1
- package/dist/components/selected-outline-types.d.ts +18 -28
- package/dist/components/selected-outline-uv.d.ts +4 -4
- package/dist/components/selected-outline-uv.js +6 -111
- package/dist/components/sequence-props-api.js +0 -10
- package/dist/components/use-selected-outline-control-target.js +12 -21
- package/dist/components/wrap-jsx-node-api.d.ts +2 -0
- package/dist/components/wrap-jsx-node-api.js +13 -0
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +45 -2
- package/dist/error-overlay/remotion-overlay/StackFrame.js +32 -3
- package/dist/esm/{CaptionQueueProcessor-k0yrm3dj.mjs → CaptionQueueProcessor-nr7hjcga.mjs} +96 -19
- package/dist/esm/LazyModels-ajkn7fs3.mjs +12 -0
- package/dist/esm/LazyModels-g1g7cf4e.mjs +12 -0
- package/dist/esm/{TranscriptionModal-ymnx1c7m.mjs → TranscriptionModal-e18bzbkb.mjs} +30 -22
- package/dist/esm/{VideoMattingModal-05vpczks.mjs → VideoMattingModal-5bz2s4rs.mjs} +47 -62
- package/dist/esm/{VideoMattingQueueProcessor-t1hgm2rm.mjs → VideoMattingQueueProcessor-4tkj0f4k.mjs} +69 -26
- package/dist/esm/{index-v4tr1bft.mjs → index-09txs1bj.mjs} +5 -0
- package/dist/esm/{index-4dsz9035.mjs → index-5ycb9e9q.mjs} +2 -4
- package/dist/esm/index-890dd9b3.mjs +768 -0
- package/dist/esm/{index-5bfxbpca.mjs → index-8nt6a0mw.mjs} +3 -3
- package/dist/esm/{index-5gd8k9yv.mjs → index-9q9w8v9p.mjs} +3 -3
- package/dist/esm/{index-x40wwfmt.mjs → index-c2wabcdt.mjs} +8 -6
- package/dist/esm/index-dfy1t576.mjs +129 -0
- package/dist/esm/index-dh3zk2hv.mjs +220 -0
- package/dist/esm/{index-0gewwxse.mjs → index-dpyss74p.mjs} +6179 -5011
- package/dist/esm/{index-9x6e1dq0.mjs → index-hqxc6tzp.mjs} +40 -6
- package/dist/esm/{index-cdy8v54v.mjs → index-qve7mdfp.mjs} +36 -539
- package/dist/esm/{index-eb5txqp6.mjs → index-s6qya2gg.mjs} +8 -88
- package/dist/esm/index-t7tbt980.mjs +103 -0
- package/dist/esm/{index-g7k2dvar.mjs → index-t7xnxdf8.mjs} +44 -26
- package/dist/esm/index-wqc43mw0.mjs +158 -0
- package/dist/esm/{index-bs39wngg.mjs → index-x6r9bn12.mjs} +5623 -6218
- package/dist/esm/{index-f97r9e2g.mjs → index-xac20sv4.mjs} +46 -57
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/internals.mjs +13 -10
- package/dist/esm/previewEntry.mjs +18 -12
- package/dist/esm/renderEntry.mjs +5 -1
- package/dist/esm/{resolve-composition-component-location-bt2d6qxq.mjs → resolve-composition-component-location-2hgf6g0a.mjs} +1 -1
- package/dist/helpers/calculate-timeline.d.ts +5 -1
- package/dist/helpers/calculate-timeline.js +1 -1
- package/dist/helpers/checkerboard-background.d.ts +2 -2
- package/dist/helpers/colors.d.ts +132 -112
- package/dist/helpers/colors.js +117 -95
- package/dist/helpers/copy-text.js +1 -16
- package/dist/helpers/create-folder-tree.js +2 -1
- package/dist/helpers/editor-guide-selection.d.ts +1 -1
- package/dist/helpers/editor-ruler.js +23 -12
- package/dist/helpers/get-connected-compositions.d.ts +6 -1
- package/dist/helpers/get-connected-compositions.js +1 -1
- package/dist/helpers/get-sequence-double-click-action.js +1 -1
- package/dist/helpers/get-sequence-visible-range.d.ts +1 -1
- package/dist/helpers/get-sequence-visible-range.js +2 -5
- package/dist/helpers/get-timeline-nestedness.d.ts +1 -1
- package/dist/helpers/get-timeline-nestedness.js +1 -1
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -1
- package/dist/helpers/get-timeline-sequence-sort-key.js +1 -1
- package/dist/helpers/hoverable.js +6 -5
- package/dist/helpers/inject-css.js +5 -7
- package/dist/helpers/open-in-editor.js +1 -1
- package/dist/helpers/prism-vsc-dark-plus.d.ts +1 -1
- package/dist/helpers/prism-vsc-dark-plus.js +52 -51
- package/dist/helpers/resolve-studio-color.d.ts +1 -0
- package/dist/helpers/resolve-studio-color.js +11 -0
- package/dist/helpers/studio-css-variables.d.ts +1 -0
- package/dist/helpers/studio-css-variables.js +105 -0
- package/dist/helpers/studio-pixel-ratio.d.ts +1 -0
- package/dist/helpers/studio-pixel-ratio.js +7 -0
- package/dist/helpers/studio-runtime-config.d.ts +1 -1
- package/dist/helpers/timeline-node-path-key.d.ts +1 -1
- package/dist/helpers/timeline-node-path-key.js +2 -2
- package/dist/helpers/use-keybinding.d.ts +1 -1
- package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -2
- package/dist/helpers/use-menu-structure.js +15 -9
- package/dist/helpers/use-runtime-values.js +2 -28
- package/dist/hot-middleware-client/client.js +5 -3
- package/dist/icons/align-center-horizontal.js +2 -1
- package/dist/icons/align-left.js +2 -1
- package/dist/icons/align-right.js +2 -1
- package/dist/icons/{separation.d.ts → background-removal.d.ts} +1 -1
- package/dist/icons/background-removal.js +9 -0
- package/dist/icons/wrap.d.ts +4 -0
- package/dist/icons/wrap.js +10 -0
- package/dist/previewEntry.js +2 -0
- package/dist/renderEntry.js +2 -0
- package/dist/state/modals.d.ts +20 -1
- package/dist/state/timeline-sequence-hover.d.ts +6 -16
- package/dist/state/timeline-sequence-hover.js +6 -67
- package/dist/state/timeline-zoom.js +4 -0
- package/package.json +20 -19
- package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.d.ts +0 -15
- package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.js +0 -31
- package/dist/components/delete-jsx-node-api.d.ts +0 -2
- package/dist/esm/LazyModels-mtggyjye.mjs +0 -11
- package/dist/esm/LazyModels-nk7py0zt.mjs +0 -11
- package/dist/esm/index-cw0pnpg5.mjs +0 -50
- package/dist/esm/index-k426ye99.mjs +0 -139
- package/dist/helpers/get-box-quads-polyfill-internals.d.ts +0 -82
- package/dist/helpers/get-box-quads-polyfill-internals.js +0 -2403
- package/dist/helpers/get-box-quads-ponyfill.d.ts +0 -10
- package/dist/helpers/get-box-quads-ponyfill.js +0 -23
- package/dist/icons/separation.js +0 -7
|
@@ -1,257 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.orderOutlinesForRendering = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const outlineBoundsOverlapTolerance = 0.5;
|
|
7
|
-
const outlinePointsAreEquivalent = (a, b) => {
|
|
8
|
-
return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
|
|
9
|
-
Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
|
|
10
|
-
};
|
|
11
|
-
const outlinesHaveEquivalentHitArea = (a, b) => {
|
|
12
|
-
if (a.points.length !== b.points.length) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
|
|
16
|
-
for (const direction of [1, -1]) {
|
|
17
|
-
const pointsMatch = a.points.every((point, index) => {
|
|
18
|
-
const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
|
|
19
|
-
return outlinePointsAreEquivalent(point, b.points[bIndex]);
|
|
20
|
-
});
|
|
21
|
-
if (pointsMatch) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
};
|
|
28
|
-
const getOutlineHitArea = (outline) => {
|
|
29
|
-
let area = 0;
|
|
30
|
-
for (let i = 0; i < outline.points.length; i++) {
|
|
31
|
-
const current = outline.points[i];
|
|
32
|
-
const next = outline.points[(i + 1) % outline.points.length];
|
|
33
|
-
area += current.x * next.y - next.x * current.y;
|
|
34
|
-
}
|
|
35
|
-
return Math.abs(area) / 2;
|
|
36
|
-
};
|
|
37
|
-
const getOutlineBounds = (outline) => {
|
|
38
|
-
const xs = outline.points.map((point) => point.x);
|
|
39
|
-
const ys = outline.points.map((point) => point.y);
|
|
40
|
-
return {
|
|
41
|
-
maxX: Math.max(...xs),
|
|
42
|
-
maxY: Math.max(...ys),
|
|
43
|
-
minX: Math.min(...xs),
|
|
44
|
-
minY: Math.min(...ys),
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
const outlineBoundsOverlap = (aBounds, bBounds) => {
|
|
48
|
-
return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
|
|
49
|
-
aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
|
|
50
|
-
aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
|
|
51
|
-
aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
|
|
52
|
-
};
|
|
53
|
-
const getSequenceId = (target) => {
|
|
54
|
-
var _a;
|
|
55
|
-
var _b;
|
|
56
|
-
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;
|
|
57
|
-
};
|
|
58
|
-
const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
|
|
59
|
-
const parentBySequenceId = new Map();
|
|
60
|
-
for (const sequence of sequences) {
|
|
61
|
-
parentBySequenceId.set(sequence.id, sequence.parent);
|
|
62
|
-
}
|
|
63
|
-
for (const target of targetsByKey.values()) {
|
|
64
|
-
const sequenceId = getSequenceId(target);
|
|
65
|
-
if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
|
|
66
|
-
parentBySequenceId.set(sequenceId, target.sequence.parent);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return parentBySequenceId;
|
|
70
|
-
};
|
|
71
|
-
const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
|
|
72
|
-
var _a;
|
|
73
|
-
var _b, _c;
|
|
74
|
-
const ancestorId = getSequenceId(ancestor);
|
|
75
|
-
if (ancestorId === null) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
79
|
-
while (parentId !== null) {
|
|
80
|
-
if (parentId === ancestorId) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
};
|
|
87
|
-
const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
|
|
88
|
-
var _a;
|
|
89
|
-
var _b, _c, _d, _e;
|
|
90
|
-
const incomingEdges = new Map();
|
|
91
|
-
const outgoingEdges = new Map();
|
|
92
|
-
const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
|
|
93
|
-
for (const outline of outlines) {
|
|
94
|
-
incomingEdges.set(outline.key, new Set());
|
|
95
|
-
outgoingEdges.set(outline.key, new Set());
|
|
96
|
-
}
|
|
97
|
-
const hasPath = ({ fromKey, seen, toKey, }) => {
|
|
98
|
-
var _a;
|
|
99
|
-
if (fromKey === toKey) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
if (seen.has(fromKey)) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
seen.add(fromKey);
|
|
106
|
-
for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
|
|
107
|
-
if (hasPath({ fromKey: nextKey, seen, toKey })) {
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return false;
|
|
112
|
-
};
|
|
113
|
-
const addEdge = (before, after, options) => {
|
|
114
|
-
if (before.key === after.key) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const incoming = incomingEdges.get(after.key);
|
|
118
|
-
const outgoing = outgoingEdges.get(before.key);
|
|
119
|
-
if (incoming === undefined || outgoing === undefined) {
|
|
120
|
-
throw new Error('Expected outline to be registered before adding edge');
|
|
121
|
-
}
|
|
122
|
-
if (outgoing.has(after.key)) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
|
|
126
|
-
if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
130
|
-
}
|
|
131
|
-
incoming.add(before.key);
|
|
132
|
-
outgoing.add(after.key);
|
|
133
|
-
};
|
|
134
|
-
const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
|
|
135
|
-
// Usually, children should be above parents so nested elements are directly
|
|
136
|
-
// selectable. If an unselected child has the same hit area as its parent, put
|
|
137
|
-
// it below the parent so the wrapper can be selected. Once the child or
|
|
138
|
-
// one of its properties is selected, keep it above the parent so it remains
|
|
139
|
-
// directly draggable.
|
|
140
|
-
if (equivalentHitArea && !descendantContainsSelection) {
|
|
141
|
-
addEdge(descendant, ancestor);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
addEdge(ancestor, descendant);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const outlineBySequenceId = new Map();
|
|
148
|
-
for (const outline of outlines) {
|
|
149
|
-
const sequenceId = getSequenceId(targetsByKey.get(outline.key));
|
|
150
|
-
if (sequenceId !== null) {
|
|
151
|
-
outlineBySequenceId.set(sequenceId, outline);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// Only constrain each outline against its nearest rendered ancestor. The
|
|
155
|
-
// resulting graph follows the sequence tree, so pairwise subpixel equivalence
|
|
156
|
-
// cannot introduce contradictory edges across three nested outlines.
|
|
157
|
-
for (const descendant of outlines) {
|
|
158
|
-
const descendantTarget = targetsByKey.get(descendant.key);
|
|
159
|
-
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;
|
|
160
|
-
while (parentId !== null) {
|
|
161
|
-
const ancestor = outlineBySequenceId.get(parentId);
|
|
162
|
-
if (ancestor !== undefined) {
|
|
163
|
-
addAncestorConstraint({
|
|
164
|
-
ancestor,
|
|
165
|
-
descendant,
|
|
166
|
-
descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
|
|
167
|
-
((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
|
|
168
|
-
equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
|
|
169
|
-
});
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// For unrelated overlapping outlines, put broader hit targets below
|
|
176
|
-
// smaller ones so a large selected sequence cannot swallow clicks on
|
|
177
|
-
// a more specific element in the same canvas area.
|
|
178
|
-
const bounds = outlines.map(getOutlineBounds);
|
|
179
|
-
const areas = outlines.map(getOutlineHitArea);
|
|
180
|
-
for (let i = 0; i < outlines.length; i++) {
|
|
181
|
-
const a = outlines[i];
|
|
182
|
-
const aTarget = targetsByKey.get(a.key);
|
|
183
|
-
if (aTarget === undefined) {
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
for (let j = i + 1; j < outlines.length; j++) {
|
|
187
|
-
if (!outlineBoundsOverlap(bounds[i], bounds[j])) {
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
const aArea = areas[i];
|
|
191
|
-
const bArea = areas[j];
|
|
192
|
-
if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
const b = outlines[j];
|
|
196
|
-
const bTarget = targetsByKey.get(b.key);
|
|
197
|
-
if (bTarget === undefined) {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
const aAncestorOfB = isAncestorTarget({
|
|
201
|
-
ancestor: aTarget,
|
|
202
|
-
descendant: bTarget,
|
|
203
|
-
parentBySequenceId,
|
|
204
|
-
});
|
|
205
|
-
const bAncestorOfA = isAncestorTarget({
|
|
206
|
-
ancestor: bTarget,
|
|
207
|
-
descendant: aTarget,
|
|
208
|
-
parentBySequenceId,
|
|
209
|
-
});
|
|
210
|
-
if (aAncestorOfB || bAncestorOfA) {
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (aArea > bArea) {
|
|
214
|
-
addEdge(a, b, { skipIfCycle: true });
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
addEdge(b, a, { skipIfCycle: true });
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const emitted = new Set();
|
|
222
|
-
const visiting = new Set();
|
|
223
|
-
const ordered = [];
|
|
224
|
-
const visit = (outline) => {
|
|
225
|
-
var _a;
|
|
226
|
-
if (emitted.has(outline.key)) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
if (visiting.has(outline.key)) {
|
|
230
|
-
throw new Error('Could not determine a stable outline rendering order');
|
|
231
|
-
}
|
|
232
|
-
visiting.add(outline.key);
|
|
233
|
-
for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
|
|
234
|
-
const dependency = outlinesByKey.get(dependencyKey);
|
|
235
|
-
if (dependency === undefined) {
|
|
236
|
-
throw new Error('Expected outline dependency to exist');
|
|
237
|
-
}
|
|
238
|
-
visit(dependency);
|
|
239
|
-
}
|
|
240
|
-
visiting.delete(outline.key);
|
|
241
|
-
emitted.add(outline.key);
|
|
242
|
-
ordered.push(outline);
|
|
243
|
-
};
|
|
244
|
-
for (const outline of outlines) {
|
|
245
|
-
visit(outline);
|
|
246
|
-
}
|
|
247
|
-
return ordered;
|
|
248
|
-
};
|
|
249
|
-
const orderOutlinesForRendering = ({ outlines, sequences, targetsByKey, }) => {
|
|
250
|
-
const parentBySequenceId = getParentBySequenceId({ sequences, targetsByKey });
|
|
251
|
-
return orderOutlineGroup({
|
|
252
|
-
outlines,
|
|
253
|
-
parentBySequenceId,
|
|
254
|
-
targetsByKey,
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
exports.orderOutlinesForRendering = orderOutlinesForRendering;
|
|
4
|
+
const canvas_1 = require("@remotion/canvas");
|
|
5
|
+
({ orderCanvasOutlinesForRendering: exports.orderOutlinesForRendering } = canvas_1.CanvasInternals);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Guide } from '../state/editor-guides';
|
|
2
2
|
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
3
|
export declare const selectedOutlineSnapThresholdPx = 10;
|
|
4
|
-
export declare const selectedOutlineSnapIndicatorColor = "
|
|
4
|
+
export declare const selectedOutlineSnapIndicatorColor = "var(--remotion-studio-selected-outline-snap-color)";
|
|
5
5
|
export type SelectedOutlineSnapAxis = 'x' | 'y';
|
|
6
6
|
export type SelectedOutlineSnapTargetType = 'canvas-left' | 'canvas-right' | 'canvas-top' | 'canvas-bottom' | 'canvas-horizontal-center' | 'canvas-vertical-center' | 'guide-vertical' | 'guide-horizontal';
|
|
7
7
|
export type SelectedOutlineSnapTarget = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findSelectedOutlineSnap = exports.getSelectedOutlineSnapTargets = exports.selectedOutlineSnapIndicatorColor = exports.selectedOutlineSnapThresholdPx = void 0;
|
|
4
|
+
const colors_1 = require("../helpers/colors");
|
|
4
5
|
exports.selectedOutlineSnapThresholdPx = 10;
|
|
5
|
-
exports.selectedOutlineSnapIndicatorColor =
|
|
6
|
+
exports.selectedOutlineSnapIndicatorColor = colors_1.SELECTED_OUTLINE_SNAP_COLOR;
|
|
6
7
|
const EPSILON = 0.000001;
|
|
7
8
|
const getSelectedOutlineSnapTargets = ({ compositionHeight, compositionWidth, guides, }) => {
|
|
8
9
|
return [
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CanvasOutlineCrop, CanvasOutlineLayoutTarget, CanvasSelectableOutline } from '@remotion/canvas';
|
|
2
|
+
import type { CanUpdateSequencePropStatus, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, InteractivitySchema, InteractivitySchemaField, SequencePropsSubscriptionKey } from 'remotion';
|
|
3
3
|
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
4
|
-
import type {
|
|
4
|
+
import type { KeyframeSourceFrame } from './Timeline/get-timeline-keyframes';
|
|
5
5
|
export type SelectedOutlineContextMenuOpenResult = false | readonly ComboboxValue[];
|
|
6
6
|
export type SelectedOutlineContextMenuOpenHandler = () => SelectedOutlineContextMenuOpenResult | Promise<SelectedOutlineContextMenuOpenResult>;
|
|
7
|
-
export type SelectedOutlineLayoutTarget = {
|
|
8
|
-
readonly key: string;
|
|
9
|
-
readonly containsSelection: boolean;
|
|
10
|
-
readonly keyframeDisplayOffset: number;
|
|
11
|
-
readonly nodePathInfo: SequenceNodePathInfo;
|
|
12
|
-
readonly ref: React.RefObject<Element | null>;
|
|
13
|
-
readonly selected: boolean;
|
|
7
|
+
export type SelectedOutlineLayoutTarget = CanvasOutlineLayoutTarget & {
|
|
14
8
|
readonly selectedForCrop: boolean;
|
|
15
9
|
readonly selectedForRotation: boolean;
|
|
16
10
|
readonly selectedForTransformOrigin: boolean;
|
|
17
11
|
readonly selectedForUvHandles: boolean;
|
|
18
|
-
readonly showSelectedOutline: boolean;
|
|
19
12
|
readonly transformOriginValue: string;
|
|
20
|
-
readonly
|
|
21
|
-
readonly sequence: TSequence;
|
|
22
|
-
readonly crop: {
|
|
23
|
-
readonly left: number;
|
|
24
|
-
readonly right: number;
|
|
25
|
-
readonly top: number;
|
|
26
|
-
readonly bottom: number;
|
|
27
|
-
};
|
|
13
|
+
readonly crop: CanvasOutlineCrop;
|
|
28
14
|
};
|
|
29
15
|
export type SelectedOutlineTarget = SelectedOutlineLayoutTarget & {
|
|
30
16
|
readonly canCrop: boolean;
|
|
17
|
+
readonly pathDrag: SelectedOutlinePathDragTarget | null;
|
|
31
18
|
readonly cropDrag: SelectedOutlineCropDragTarget | null;
|
|
32
19
|
readonly drag: SelectedOutlineDragTarget | null;
|
|
33
20
|
readonly scaleDrag: SelectedOutlineScaleDragTarget | null;
|
|
34
21
|
readonly rotationDrag: SelectedOutlineRotationDragTarget | null;
|
|
35
22
|
readonly transformOriginDrag: SelectedOutlineTransformOriginDragTarget | null;
|
|
36
23
|
};
|
|
24
|
+
export type SelectedOutlinePathDragTarget = {
|
|
25
|
+
readonly clientId: string;
|
|
26
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
27
|
+
readonly schema: InteractivitySchema;
|
|
28
|
+
};
|
|
37
29
|
export declare const cropFieldKeys: {
|
|
38
30
|
readonly left: "cropLeft";
|
|
39
31
|
readonly right: "cropRight";
|
|
@@ -61,7 +53,7 @@ export type SelectedOutlineCropDragTarget = {
|
|
|
61
53
|
readonly fields: Record<SelectedOutlineCropFieldKey, SelectedOutlineCropField>;
|
|
62
54
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
63
55
|
readonly schema: InteractivitySchema;
|
|
64
|
-
readonly sourceFrame:
|
|
56
|
+
readonly sourceFrame: KeyframeSourceFrame;
|
|
65
57
|
readonly transformOrigin: {
|
|
66
58
|
readonly defaultValue: string | undefined;
|
|
67
59
|
readonly propStatus: CanUpdateSequencePropStatus;
|
|
@@ -73,12 +65,14 @@ export type SelectedOutlineDragTarget = {
|
|
|
73
65
|
readonly clientId: string;
|
|
74
66
|
readonly fieldDefault: string | undefined;
|
|
75
67
|
readonly keyframeDisplayOffset: number;
|
|
68
|
+
readonly keyframePlaybackRate: number;
|
|
76
69
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
77
70
|
readonly schema: InteractivitySchema;
|
|
78
71
|
};
|
|
79
72
|
export type SelectedOutlineTransformOriginDragTarget = {
|
|
80
73
|
readonly clientId: string;
|
|
81
74
|
readonly keyframeDisplayOffset: number;
|
|
75
|
+
readonly keyframePlaybackRate: number;
|
|
82
76
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
83
77
|
readonly originDefault: string | undefined;
|
|
84
78
|
readonly originPropStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
@@ -86,7 +80,7 @@ export type SelectedOutlineTransformOriginDragTarget = {
|
|
|
86
80
|
readonly rotateValue: string;
|
|
87
81
|
readonly scaleValue: number | string;
|
|
88
82
|
readonly schema: InteractivitySchema;
|
|
89
|
-
readonly sourceFrame:
|
|
83
|
+
readonly sourceFrame: KeyframeSourceFrame;
|
|
90
84
|
readonly translateDefault: string | undefined;
|
|
91
85
|
readonly translatePropStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
92
86
|
readonly translateValue: string;
|
|
@@ -103,6 +97,7 @@ export type SelectedOutlineScaleDragTarget = {
|
|
|
103
97
|
readonly fieldDefault: number | string | undefined;
|
|
104
98
|
readonly fieldSchema: ScaleFieldSchema;
|
|
105
99
|
readonly keyframeDisplayOffset: number;
|
|
100
|
+
readonly keyframePlaybackRate: number;
|
|
106
101
|
readonly linked: boolean;
|
|
107
102
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
108
103
|
readonly schema: InteractivitySchema;
|
|
@@ -113,6 +108,7 @@ export type SelectedOutlineRotationDragTarget = {
|
|
|
113
108
|
readonly fieldDefault: string | undefined;
|
|
114
109
|
readonly fieldSchema: RotationFieldSchema;
|
|
115
110
|
readonly keyframeDisplayOffset: number;
|
|
111
|
+
readonly keyframePlaybackRate: number;
|
|
116
112
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
117
113
|
readonly schema: InteractivitySchema;
|
|
118
114
|
readonly transform3DMode: boolean;
|
|
@@ -145,13 +141,7 @@ export type SelectedOutlineRotationDragState = {
|
|
|
145
141
|
readonly startValue: string;
|
|
146
142
|
readonly target: SelectedOutlineRotationDragTarget;
|
|
147
143
|
};
|
|
148
|
-
export type SequenceWithSelectedOutline =
|
|
149
|
-
readonly depth: number;
|
|
150
|
-
readonly keyframeDisplayOffset: number;
|
|
151
|
-
readonly key: string;
|
|
152
|
-
readonly nodePathInfo: SequenceNodePathInfo;
|
|
153
|
-
readonly sequence: TSequence;
|
|
154
|
-
};
|
|
144
|
+
export type SequenceWithSelectedOutline = CanvasSelectableOutline;
|
|
155
145
|
export declare const translateFieldKey = "style.translate";
|
|
156
146
|
export declare const scaleFieldKey = "style.scale";
|
|
157
147
|
export declare const rotateFieldKey = "style.rotate";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, GetEffectDragOverrides, PropStatuses, InteractivitySchemaField, SequencePropsSubscriptionKey, InteractivitySchema, TSequence } from 'remotion';
|
|
2
2
|
import { type OutlinePoint } from './selected-outline-geometry';
|
|
3
|
+
import { type KeyframeSourceFrame } from './Timeline/get-timeline-keyframes';
|
|
4
|
+
export declare const getUvHandlePosition: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], uv: import("@remotion/canvas").CanvasOutlineUv) => OutlinePoint, getUvCoordinateForPoint: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], point: OutlinePoint) => import("@remotion/canvas").CanvasOutlineUv;
|
|
3
5
|
export type UvCoordinate = readonly [number, number];
|
|
4
6
|
type UvEllipseDimensions = {
|
|
5
7
|
readonly width: number;
|
|
@@ -36,7 +38,7 @@ export type SelectedOutlineUvHandle = {
|
|
|
36
38
|
readonly isSelected: boolean;
|
|
37
39
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
38
40
|
readonly schema: InteractivitySchema;
|
|
39
|
-
readonly sourceFrame:
|
|
41
|
+
readonly sourceFrame: KeyframeSourceFrame;
|
|
40
42
|
readonly value: UvCoordinate;
|
|
41
43
|
};
|
|
42
44
|
type UvConnectionHandle = Pick<SelectedOutlineUvHandle, 'effectIndex' | 'fieldKey' | 'fieldSchema' | 'value'> & {
|
|
@@ -87,7 +89,6 @@ type SelectedEffectFields = {
|
|
|
87
89
|
readonly fieldKeys: ReadonlySet<string>;
|
|
88
90
|
};
|
|
89
91
|
export declare const tuplesEqual: (left: unknown, right: UvCoordinate) => boolean;
|
|
90
|
-
export declare const getUvHandlePosition: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], uv: UvCoordinate) => OutlinePoint;
|
|
91
92
|
export declare const getUvHandleConnectionLines: ({ handles, points, }: {
|
|
92
93
|
readonly handles: readonly UvConnectionHandle[];
|
|
93
94
|
readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
|
|
@@ -102,7 +103,6 @@ export declare const getUvEllipseInteractiveControls: ({ handles, dimensions, po
|
|
|
102
103
|
readonly dimensions?: UvEllipseDimensions | null | undefined;
|
|
103
104
|
readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
|
|
104
105
|
}) => UvEllipseInteractiveControls[];
|
|
105
|
-
export declare const getUvCoordinateForPoint: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], point: OutlinePoint) => UvCoordinate;
|
|
106
106
|
export declare function constrainUv(value: UvCoordinate, schema: UvCoordinateFieldSchema): UvCoordinate;
|
|
107
107
|
export declare function roundUvCoordinate(value: UvCoordinate, schema: UvCoordinateFieldSchema): UvCoordinate;
|
|
108
108
|
export declare const roundNumericUvEllipseValue: (value: number, schema: NumericUvEllipseFieldSchema) => number;
|
|
@@ -113,6 +113,6 @@ export declare const getSelectedUvHandles: ({ propStatuses, clientId, getEffectD
|
|
|
113
113
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
114
114
|
readonly selectedEffects: Map<number, SelectedEffectFields> | undefined;
|
|
115
115
|
readonly sequence: TSequence;
|
|
116
|
-
readonly sourceFrame:
|
|
116
|
+
readonly sourceFrame: KeyframeSourceFrame;
|
|
117
117
|
}) => SelectedOutlineUvHandle[];
|
|
118
118
|
export {};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSelectedUvHandles = exports.roundNumericUvEllipseValue = exports.
|
|
3
|
+
exports.getSelectedUvHandles = exports.roundNumericUvEllipseValue = exports.getUvEllipseInteractiveControls = exports.getUvHandleConnectionEllipses = exports.getUvHandleConnectionLines = exports.tuplesEqual = exports.getUvCoordinateForPoint = exports.getUvHandlePosition = void 0;
|
|
4
4
|
exports.constrainUv = constrainUv;
|
|
5
5
|
exports.roundUvCoordinate = roundUvCoordinate;
|
|
6
|
+
const canvas_1 = require("@remotion/canvas");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const selected_outline_geometry_1 = require("./selected-outline-geometry");
|
|
9
|
+
const get_timeline_keyframes_1 = require("./Timeline/get-timeline-keyframes");
|
|
8
10
|
const timeline_field_utils_1 = require("./Timeline/timeline-field-utils");
|
|
11
|
+
({ getCanvasOutlinePoint: exports.getUvHandlePosition, getCanvasOutlineUv: exports.getUvCoordinateForPoint } = canvas_1.CanvasInternals);
|
|
9
12
|
const parseUvCoordinate = (value) => {
|
|
10
13
|
if (Array.isArray(value) &&
|
|
11
14
|
value.length === 2 &&
|
|
@@ -91,56 +94,6 @@ const tuplesEqual = (left, right) => {
|
|
|
91
94
|
return left[0] === right[0] && left[1] === right[1];
|
|
92
95
|
};
|
|
93
96
|
exports.tuplesEqual = tuplesEqual;
|
|
94
|
-
const getBilinearUvHandlePosition = (points, uv) => {
|
|
95
|
-
const [tl, tr, br, bl] = points;
|
|
96
|
-
const top = (0, selected_outline_geometry_1.mixPoint)(tl, tr, uv[0]);
|
|
97
|
-
const bottom = (0, selected_outline_geometry_1.mixPoint)(bl, br, uv[0]);
|
|
98
|
-
return (0, selected_outline_geometry_1.mixPoint)(top, bottom, uv[1]);
|
|
99
|
-
};
|
|
100
|
-
const projectiveEpsilon = 0.000001;
|
|
101
|
-
const getProjectiveTransform = (points) => {
|
|
102
|
-
const [tl, tr, br, bl] = points;
|
|
103
|
-
const dx1 = tr.x - br.x;
|
|
104
|
-
const dx2 = bl.x - br.x;
|
|
105
|
-
const dx3 = tl.x - tr.x + br.x - bl.x;
|
|
106
|
-
const dy1 = tr.y - br.y;
|
|
107
|
-
const dy2 = bl.y - br.y;
|
|
108
|
-
const dy3 = tl.y - tr.y + br.y - bl.y;
|
|
109
|
-
let g = 0;
|
|
110
|
-
let h = 0;
|
|
111
|
-
if (Math.abs(dx3) > projectiveEpsilon || Math.abs(dy3) > projectiveEpsilon) {
|
|
112
|
-
const determinant = dx1 * dy2 - dx2 * dy1;
|
|
113
|
-
if (Math.abs(determinant) < projectiveEpsilon) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
g = (dx3 * dy2 - dx2 * dy3) / determinant;
|
|
117
|
-
h = (dx1 * dy3 - dx3 * dy1) / determinant;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
a: tr.x - tl.x + g * tr.x,
|
|
121
|
-
b: bl.x - tl.x + h * bl.x,
|
|
122
|
-
c: tl.x,
|
|
123
|
-
d: tr.y - tl.y + g * tr.y,
|
|
124
|
-
e: bl.y - tl.y + h * bl.y,
|
|
125
|
-
f: tl.y,
|
|
126
|
-
g,
|
|
127
|
-
h,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
const applyProjectiveTransform = (transform, uv) => {
|
|
131
|
-
const denominator = transform.g * uv[0] + transform.h * uv[1] + 1;
|
|
132
|
-
return {
|
|
133
|
-
x: (transform.a * uv[0] + transform.b * uv[1] + transform.c) / denominator,
|
|
134
|
-
y: (transform.d * uv[0] + transform.e * uv[1] + transform.f) / denominator,
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
const getUvHandlePosition = (points, uv) => {
|
|
138
|
-
const transform = getProjectiveTransform(points);
|
|
139
|
-
return transform === null
|
|
140
|
-
? getBilinearUvHandlePosition(points, uv)
|
|
141
|
-
: applyProjectiveTransform(transform, uv);
|
|
142
|
-
};
|
|
143
|
-
exports.getUvHandlePosition = getUvHandlePosition;
|
|
144
97
|
const getUvHandleConnectionLines = ({ handles, points, }) => {
|
|
145
98
|
const handlesByField = new Map(handles.map((handle) => [
|
|
146
99
|
`${handle.effectIndex}\u0000${handle.fieldKey}`,
|
|
@@ -337,64 +290,6 @@ const getUvEllipseInteractiveControls = ({ handles, dimensions, points, }) => {
|
|
|
337
290
|
return controls;
|
|
338
291
|
};
|
|
339
292
|
exports.getUvEllipseInteractiveControls = getUvEllipseInteractiveControls;
|
|
340
|
-
const vectorBetween = (from, to) => {
|
|
341
|
-
return { x: to.x - from.x, y: to.y - from.y };
|
|
342
|
-
};
|
|
343
|
-
const getBilinearUvCoordinateForPoint = (points, point) => {
|
|
344
|
-
const [tl, tr, br, bl] = points;
|
|
345
|
-
let u = 0.5;
|
|
346
|
-
let v = 0.5;
|
|
347
|
-
for (let i = 0; i < 8; i++) {
|
|
348
|
-
const current = getBilinearUvHandlePosition(points, [u, v]);
|
|
349
|
-
const errorX = current.x - point.x;
|
|
350
|
-
const errorY = current.y - point.y;
|
|
351
|
-
if (Math.abs(errorX) + Math.abs(errorY) < 0.001) {
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
const du = {
|
|
355
|
-
x: (0, selected_outline_geometry_1.mix)(tr.x - tl.x, br.x - bl.x, v),
|
|
356
|
-
y: (0, selected_outline_geometry_1.mix)(tr.y - tl.y, br.y - bl.y, v),
|
|
357
|
-
};
|
|
358
|
-
const dv = vectorBetween((0, selected_outline_geometry_1.mixPoint)(tl, tr, u), (0, selected_outline_geometry_1.mixPoint)(bl, br, u));
|
|
359
|
-
const determinant = du.x * dv.y - du.y * dv.x;
|
|
360
|
-
if (Math.abs(determinant) < 0.000001) {
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
u -= (errorX * dv.y - errorY * dv.x) / determinant;
|
|
364
|
-
v -= (du.x * errorY - du.y * errorX) / determinant;
|
|
365
|
-
}
|
|
366
|
-
return [u, v];
|
|
367
|
-
};
|
|
368
|
-
const getUvCoordinateForPoint = (points, point) => {
|
|
369
|
-
const transform = getProjectiveTransform(points);
|
|
370
|
-
if (transform === null) {
|
|
371
|
-
return getBilinearUvCoordinateForPoint(points, point);
|
|
372
|
-
}
|
|
373
|
-
const determinant = transform.a * (transform.e - transform.f * transform.h) -
|
|
374
|
-
transform.b * (transform.d - transform.f * transform.g) +
|
|
375
|
-
transform.c * (transform.d * transform.h - transform.e * transform.g);
|
|
376
|
-
if (Math.abs(determinant) < projectiveEpsilon) {
|
|
377
|
-
return getBilinearUvCoordinateForPoint(points, point);
|
|
378
|
-
}
|
|
379
|
-
const inverseA = transform.e - transform.f * transform.h;
|
|
380
|
-
const inverseB = transform.c * transform.h - transform.b;
|
|
381
|
-
const inverseC = transform.b * transform.f - transform.c * transform.e;
|
|
382
|
-
const inverseD = transform.f * transform.g - transform.d;
|
|
383
|
-
const inverseE = transform.a - transform.c * transform.g;
|
|
384
|
-
const inverseF = transform.c * transform.d - transform.a * transform.f;
|
|
385
|
-
const inverseG = transform.d * transform.h - transform.e * transform.g;
|
|
386
|
-
const inverseH = transform.b * transform.g - transform.a * transform.h;
|
|
387
|
-
const inverseI = transform.a * transform.e - transform.b * transform.d;
|
|
388
|
-
const denominator = inverseG * point.x + inverseH * point.y + inverseI;
|
|
389
|
-
if (Math.abs(denominator) < projectiveEpsilon) {
|
|
390
|
-
return getBilinearUvCoordinateForPoint(points, point);
|
|
391
|
-
}
|
|
392
|
-
return [
|
|
393
|
-
(inverseA * point.x + inverseB * point.y + inverseC) / denominator,
|
|
394
|
-
(inverseD * point.x + inverseE * point.y + inverseF) / denominator,
|
|
395
|
-
];
|
|
396
|
-
};
|
|
397
|
-
exports.getUvCoordinateForPoint = getUvCoordinateForPoint;
|
|
398
293
|
function constrainUv(value, schema) {
|
|
399
294
|
var _a, _b;
|
|
400
295
|
const min = (_a = schema.min) !== null && _a !== void 0 ? _a : -Infinity;
|
|
@@ -515,7 +410,7 @@ const getSelectedUvHandles = ({ propStatuses, clientId, getEffectDragOverrides,
|
|
|
515
410
|
propStatus,
|
|
516
411
|
dragOverrideValue: dragOverrides[key],
|
|
517
412
|
defaultValue: undefined,
|
|
518
|
-
frame: sourceFrame,
|
|
413
|
+
frame: (0, get_timeline_keyframes_1.resolveKeyframeSourceFrame)(sourceFrame, propStatus),
|
|
519
414
|
shouldResortToDefaultValueIfUndefined: false,
|
|
520
415
|
});
|
|
521
416
|
});
|
|
@@ -533,7 +428,7 @@ const getSelectedUvHandles = ({ propStatuses, clientId, getEffectDragOverrides,
|
|
|
533
428
|
propStatus,
|
|
534
429
|
dragOverrideValue: dragOverrides[fieldKey],
|
|
535
430
|
defaultValue: fieldSchema.default,
|
|
536
|
-
frame: sourceFrame,
|
|
431
|
+
frame: (0, get_timeline_keyframes_1.resolveKeyframeSourceFrame)(sourceFrame, propStatus),
|
|
537
432
|
shouldResortToDefaultValueIfUndefined: true,
|
|
538
433
|
});
|
|
539
434
|
}
|
|
@@ -9,19 +9,9 @@ const flushSequencePropsSubscriptions = () => {
|
|
|
9
9
|
sequencePropsSubscriptionTimer = null;
|
|
10
10
|
const pending = pendingSequencePropsSubscriptions;
|
|
11
11
|
pendingSequencePropsSubscriptions = [];
|
|
12
|
-
const firstRequest = pending[0].request;
|
|
13
12
|
(0, call_api_1.callApi)('/api/subscribe-to-sequence-props', {
|
|
14
|
-
...firstRequest,
|
|
15
13
|
requests: pending.map(({ request }) => request),
|
|
16
14
|
}).then((response) => {
|
|
17
|
-
if (!Array.isArray(response.results)) {
|
|
18
|
-
pending[0].resolve(response);
|
|
19
|
-
const error = new Error('Legacy single subscription response received for a batched request');
|
|
20
|
-
for (const item of pending.slice(1)) {
|
|
21
|
-
item.reject(error);
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
15
|
if (response.results.length !== pending.length) {
|
|
26
16
|
const error = new Error(`Expected ${pending.length} sequence prop subscription results, got ${response.results.length}`);
|
|
27
17
|
for (const item of pending) {
|
|
@@ -34,11 +34,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.useSelectedOutlineControlTarget = void 0;
|
|
37
|
+
const canvas_1 = require("@remotion/canvas");
|
|
37
38
|
const react_1 = __importStar(require("react"));
|
|
38
|
-
const timeline_node_path_key_1 = require("../helpers/timeline-node-path-key");
|
|
39
39
|
const timeline_sequence_hover_1 = require("../state/timeline-sequence-hover");
|
|
40
40
|
const useSelectedOutlineControlTarget = ({ getLatestTargetByKey, layoutTarget, }) => {
|
|
41
|
-
|
|
41
|
+
var _a;
|
|
42
|
+
const hoverController = (0, react_1.useContext)(timeline_sequence_hover_1.TimelineSequenceHoverContext);
|
|
42
43
|
const targetRef = (0, react_1.useRef)(layoutTarget);
|
|
43
44
|
(0, react_1.useLayoutEffect)(() => {
|
|
44
45
|
targetRef.current = layoutTarget;
|
|
@@ -51,29 +52,19 @@ const useSelectedOutlineControlTarget = ({ getLatestTargetByKey, layoutTarget, }
|
|
|
51
52
|
return getLatestTargetByKey(currentTarget.key);
|
|
52
53
|
}, [getLatestTargetByKey]);
|
|
53
54
|
const getLayoutTarget = react_1.default.useCallback(() => targetRef.current, []);
|
|
54
|
-
const
|
|
55
|
-
? null
|
|
56
|
-
: (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(layoutTarget.nodePathInfo.sequenceSubscriptionKey), [layoutTarget]);
|
|
57
|
-
const hovered = (0, timeline_sequence_hover_1.useIsTimelineSequenceHovered)(hoveredNodePathKey);
|
|
55
|
+
const { hovered, onPointerEnter, onPointerLeave } = (0, canvas_1.useCanvasSequenceHover)(hoverController, (_a = layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.nodePathInfo) !== null && _a !== void 0 ? _a : null, 'canvas');
|
|
58
56
|
const controlTarget = layoutTarget !== undefined && (layoutTarget.containsSelection || hovered)
|
|
59
57
|
? getLatestTargetByKey(layoutTarget.key)
|
|
60
58
|
: undefined;
|
|
61
59
|
const onHoverChange = react_1.default.useCallback((key) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
nodePathKey: (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(hoverTarget.nodePathInfo.sequenceSubscriptionKey),
|
|
71
|
-
source: 'canvas',
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover;
|
|
75
|
-
});
|
|
76
|
-
}, [setHoveredSequence]);
|
|
60
|
+
var _a;
|
|
61
|
+
if (key === null) {
|
|
62
|
+
onPointerLeave();
|
|
63
|
+
}
|
|
64
|
+
else if (((_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.key) === key) {
|
|
65
|
+
onPointerEnter();
|
|
66
|
+
}
|
|
67
|
+
}, [onPointerEnter, onPointerLeave]);
|
|
77
68
|
return { controlTarget, getLayoutTarget, getTarget, hovered, onHoverChange };
|
|
78
69
|
};
|
|
79
70
|
exports.useSelectedOutlineControlTarget = useSelectedOutlineControlTarget;
|