@remotion/studio 4.0.527 → 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.
Files changed (258) hide show
  1. package/dist/components/AgentPrompt.js +1 -2
  2. package/dist/components/AudioWaveform.d.ts +1 -0
  3. package/dist/components/AudioWaveform.js +10 -14
  4. package/dist/components/CodeFrame.js +1 -1
  5. package/dist/components/ColorPicker/checker.d.ts +1 -1
  6. package/dist/components/CurrentAsset.js +3 -2
  7. package/dist/components/EditorRuler/Ruler.js +6 -3
  8. package/dist/components/EffectPickerModal.js +69 -43
  9. package/dist/components/ElementInstallConfirmation.js +3 -3
  10. package/dist/components/ElementLibrariesSettings.d.ts +2 -0
  11. package/dist/components/ElementLibrariesSettings.js +200 -0
  12. package/dist/components/InitialCompositionLoader.js +3 -1
  13. package/dist/components/InspectorOpenInEditor.js +13 -0
  14. package/dist/components/InspectorPanel/AlignmentControls.js +28 -9
  15. package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +1 -1
  16. package/dist/components/InspectorPanel/EasingInspector.js +6 -2
  17. package/dist/components/InspectorPanel/ElementLibraryButton.js +1 -1
  18. package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +1 -1
  19. package/dist/components/InspectorPanel/KeyframeInspector.js +28 -24
  20. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +1 -1
  21. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -1
  22. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +30 -2
  23. package/dist/components/InspectorPanel/SequenceWrapAction.d.ts +8 -0
  24. package/dist/components/InspectorPanel/SequenceWrapAction.js +151 -0
  25. package/dist/components/InspectorPanel/easing-inspector-selection.d.ts +2 -1
  26. package/dist/components/InspectorPanel/easing-inspector-selection.js +4 -3
  27. package/dist/components/InspectorPanel/keyframe-inspector-frame.d.ts +2 -1
  28. package/dist/components/InspectorPanel/keyframe-inspector-frame.js +2 -2
  29. package/dist/components/InspectorSequenceSection.d.ts +1 -0
  30. package/dist/components/InspectorSequenceSection.js +7 -5
  31. package/dist/components/KeyboardShortcutsSettings.js +1 -1
  32. package/dist/components/Menu/styles.d.ts +2 -2
  33. package/dist/components/Modals.js +7 -6
  34. package/dist/components/ModelManager.js +10 -9
  35. package/dist/components/NewComposition/CancelButton.js +10 -4
  36. package/dist/components/NewComposition/InputDragger.d.ts +3 -1
  37. package/dist/components/NewComposition/InputDragger.js +28 -9
  38. package/dist/components/NewComposition/NewComposition.js +7 -6
  39. package/dist/components/NewComposition/RemInput.d.ts +1 -1
  40. package/dist/components/NewComposition/menu-typeahead.js +1 -1
  41. package/dist/components/Preview.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +1 -2
  43. package/dist/components/RenderModal/WebRenderModalPicture.js +1 -2
  44. package/dist/components/RenderQueue/CaptionQueueItem.js +14 -5
  45. package/dist/components/RenderQueue/CaptionQueueProcessor.js +30 -7
  46. package/dist/components/RenderQueue/QueueJobError.d.ts +8 -0
  47. package/dist/components/RenderQueue/QueueJobError.js +24 -0
  48. package/dist/components/RenderQueue/QueueJobErrorModal.d.ts +8 -0
  49. package/dist/components/RenderQueue/QueueJobErrorModal.js +63 -0
  50. package/dist/components/RenderQueue/RenderQueueItemCancelButton.d.ts +3 -1
  51. package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +11 -4
  52. package/dist/components/RenderQueue/RenderQueueRepeat.d.ts +3 -1
  53. package/dist/components/RenderQueue/RenderQueueRepeat.js +20 -3
  54. package/dist/components/RenderQueue/VideoMattingQueueItem.js +24 -27
  55. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +68 -28
  56. package/dist/components/RenderQueue/caption-job-types.d.ts +3 -1
  57. package/dist/components/RenderQueue/context.d.ts +4 -0
  58. package/dist/components/RenderQueue/context.js +58 -8
  59. package/dist/components/RenderQueue/index.js +2 -3
  60. package/dist/components/RenderQueue/load-model-for-job.d.ts +2 -1
  61. package/dist/components/RenderQueue/load-model-for-job.js +5 -1
  62. package/dist/components/RenderQueue/video-matting-job-types.d.ts +13 -6
  63. package/dist/components/SelectedOutlineCropControls.js +2 -1
  64. package/dist/components/SelectedOutlineEditingHandles.js +9 -2
  65. package/dist/components/SelectedOutlineElement.js +9 -3
  66. package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -4
  67. package/dist/components/SelectedOutlineKeyboardControls.js +4 -22
  68. package/dist/components/SelectedOutlineOverlay.js +152 -106
  69. package/dist/components/SelectedOutlinePathPoints.d.ts +8 -0
  70. package/dist/components/SelectedOutlinePathPoints.js +433 -0
  71. package/dist/components/SelectedOutlinePolygon.js +21 -46
  72. package/dist/components/SelectedOutlineRenderer.d.ts +3 -5
  73. package/dist/components/SelectedOutlineRenderer.js +32 -136
  74. package/dist/components/SelectedOutlineTransformOriginHandle.js +3 -2
  75. package/dist/components/SelectedOutlineUvControls.js +12 -7
  76. package/dist/components/SettingsModal.js +30 -3
  77. package/dist/components/SettingsModalFooter.d.ts +1 -0
  78. package/dist/components/SettingsModalFooter.js +7 -3
  79. package/dist/components/ShowOutlinesProvider.js +1 -1
  80. package/dist/components/SkillsSettings.d.ts +0 -1
  81. package/dist/components/SkillsSettings.js +13 -14
  82. package/dist/components/Splitter/SplitterElement.js +1 -2
  83. package/dist/components/TimeValue.js +1 -1
  84. package/dist/components/Timeline/LoopedTimelineIndicators.d.ts +1 -0
  85. package/dist/components/Timeline/LoopedTimelineIndicators.js +7 -6
  86. package/dist/components/Timeline/TimelineArrayField.js +1 -1
  87. package/dist/components/Timeline/TimelineClipboardKeybindings.js +0 -1
  88. package/dist/components/Timeline/TimelineColorField.js +1 -1
  89. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  90. package/dist/components/Timeline/TimelineEffectPropItem.d.ts +1 -0
  91. package/dist/components/Timeline/TimelineEffectPropItem.js +12 -5
  92. package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -0
  93. package/dist/components/Timeline/TimelineExpandedRow.js +5 -4
  94. package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -0
  95. package/dist/components/Timeline/TimelineExpandedSection.js +2 -2
  96. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +1 -0
  97. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +3 -1
  98. package/dist/components/Timeline/TimelineFontFamilyField.js +12 -12
  99. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +1 -0
  100. package/dist/components/Timeline/TimelineKeyframeControls.js +39 -28
  101. package/dist/components/Timeline/TimelineLayerChildren.js +1 -1
  102. package/dist/components/Timeline/TimelineList.js +1 -1
  103. package/dist/components/Timeline/TimelineNumberField.js +2 -4
  104. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
  105. package/dist/components/Timeline/TimelineSelection.d.ts +9 -9
  106. package/dist/components/Timeline/TimelineSelection.js +16 -9
  107. package/dist/components/Timeline/TimelineSequence.d.ts +3 -1
  108. package/dist/components/Timeline/TimelineSequence.js +39 -21
  109. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  110. package/dist/components/Timeline/TimelineSequenceItem.js +18 -8
  111. package/dist/components/Timeline/TimelineSequencePropItem.d.ts +3 -0
  112. package/dist/components/Timeline/TimelineSequencePropItem.js +262 -25
  113. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +11 -13
  114. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +98 -77
  115. package/dist/components/Timeline/TimelineTextContentField.js +27 -4
  116. package/dist/components/Timeline/TimelineTimeIndicators.js +10 -5
  117. package/dist/components/Timeline/TimelineTrack.js +1 -1
  118. package/dist/components/Timeline/TimelineTrimTooltip.d.ts +11 -0
  119. package/dist/components/Timeline/TimelineTrimTooltip.js +41 -0
  120. package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
  121. package/dist/components/Timeline/TimelineVideoInfo.js +13 -10
  122. package/dist/components/Timeline/delete-selected-keyframe.js +22 -8
  123. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +1 -5
  124. package/dist/components/Timeline/delete-selected-timeline-item.js +7 -93
  125. package/dist/components/Timeline/get-animation-item-selection-for-frame.d.ts +2 -1
  126. package/dist/components/Timeline/get-animation-item-selection-for-frame.js +7 -5
  127. package/dist/components/Timeline/get-keyframed-sequence-drag-targets.d.ts +23 -0
  128. package/dist/components/Timeline/get-keyframed-sequence-drag-targets.js +57 -0
  129. package/dist/components/Timeline/get-node-keyframes.d.ts +2 -1
  130. package/dist/components/Timeline/get-node-keyframes.js +6 -4
  131. package/dist/components/Timeline/get-playback-rate-keyframe-changes.d.ts +21 -0
  132. package/dist/components/Timeline/get-playback-rate-keyframe-changes.js +142 -0
  133. package/dist/components/Timeline/get-timeline-keyframes.d.ts +15 -2
  134. package/dist/components/Timeline/get-timeline-keyframes.js +44 -6
  135. package/dist/components/Timeline/keyframe-clipboard.js +17 -3
  136. package/dist/components/Timeline/split-selected-timeline-item.js +4 -1
  137. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  138. package/dist/components/Timeline/timeline-field-row-layout.js +1 -0
  139. package/dist/components/Timeline/use-delete-timeline-items.js +17 -11
  140. package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +2 -1
  141. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +3 -1
  142. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +7 -3
  143. package/dist/components/Timeline/use-timeline-keyframe-drag.js +28 -19
  144. package/dist/components/Transcription/Models.js +1 -1
  145. package/dist/components/Transcription/TranscriptionModal.js +3 -1
  146. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +2 -1
  147. package/dist/components/Transcription/resample-media-to-16-khz.js +20 -2
  148. package/dist/components/UpdatesSettings.js +2 -0
  149. package/dist/components/VideoMatting/Models.js +1 -1
  150. package/dist/components/VideoMatting/VideoMattingModal.js +30 -47
  151. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +1 -1
  152. package/dist/components/WebMcp.js +22 -40
  153. package/dist/components/composition-drop-preview.js +1 -0
  154. package/dist/components/effect-drag-and-drop.d.ts +13 -5
  155. package/dist/components/effect-drag-and-drop.js +19 -4
  156. package/dist/components/get-open-in-menu-items.d.ts +2 -1
  157. package/dist/components/get-open-in-menu-items.js +17 -1
  158. package/dist/components/selected-outline-drag.d.ts +1 -6
  159. package/dist/components/selected-outline-drag.js +22 -6
  160. package/dist/components/selected-outline-geometry.d.ts +2 -18
  161. package/dist/components/selected-outline-measurement.d.ts +23 -41
  162. package/dist/components/selected-outline-measurement.js +14 -252
  163. package/dist/components/selected-outline-order.d.ts +4 -11
  164. package/dist/components/selected-outline-order.js +2 -254
  165. package/dist/components/selected-outline-snap.d.ts +1 -1
  166. package/dist/components/selected-outline-snap.js +2 -1
  167. package/dist/components/selected-outline-types.d.ts +18 -28
  168. package/dist/components/selected-outline-uv.d.ts +4 -4
  169. package/dist/components/selected-outline-uv.js +6 -111
  170. package/dist/components/sequence-props-api.js +0 -10
  171. package/dist/components/use-selected-outline-control-target.js +12 -21
  172. package/dist/components/wrap-jsx-node-api.d.ts +2 -0
  173. package/dist/components/wrap-jsx-node-api.js +13 -0
  174. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +45 -2
  175. package/dist/error-overlay/remotion-overlay/StackFrame.js +32 -3
  176. package/dist/esm/{CaptionQueueProcessor-npa6szn1.mjs → CaptionQueueProcessor-nr7hjcga.mjs} +63 -17
  177. package/dist/esm/LazyModels-ajkn7fs3.mjs +12 -0
  178. package/dist/esm/LazyModels-g1g7cf4e.mjs +12 -0
  179. package/dist/esm/{TranscriptionModal-79m5wgcj.mjs → TranscriptionModal-e18bzbkb.mjs} +15 -15
  180. package/dist/esm/{VideoMattingModal-31pew0xj.mjs → VideoMattingModal-5bz2s4rs.mjs} +47 -65
  181. package/dist/esm/{VideoMattingQueueProcessor-t1hgm2rm.mjs → VideoMattingQueueProcessor-4tkj0f4k.mjs} +69 -26
  182. package/dist/esm/{index-v4tr1bft.mjs → index-09txs1bj.mjs} +5 -0
  183. package/dist/esm/{index-n5gmcvhz.mjs → index-5ycb9e9q.mjs} +2 -4
  184. package/dist/esm/{index-5t2dwxsk.mjs → index-890dd9b3.mjs} +259 -21
  185. package/dist/esm/{index-ac5550e7.mjs → index-8nt6a0mw.mjs} +3 -3
  186. package/dist/esm/{index-614tdz2q.mjs → index-9q9w8v9p.mjs} +3 -3
  187. package/dist/esm/{index-s7qa3xbw.mjs → index-c2wabcdt.mjs} +6 -6
  188. package/dist/esm/{index-r1gr3j3a.mjs → index-dfy1t576.mjs} +50 -1
  189. package/dist/esm/{index-21hxsfaa.mjs → index-dh3zk2hv.mjs} +6 -25
  190. package/dist/esm/{index-4zen9prq.mjs → index-dpyss74p.mjs} +6563 -5485
  191. package/dist/esm/{index-9x6e1dq0.mjs → index-hqxc6tzp.mjs} +40 -6
  192. package/dist/esm/{index-9xxg6218.mjs → index-qve7mdfp.mjs} +19 -1
  193. package/dist/esm/{index-e855w59j.mjs → index-s6qya2gg.mjs} +3 -5
  194. package/dist/esm/index-t7tbt980.mjs +103 -0
  195. package/dist/esm/{index-r0ejh5sy.mjs → index-t7xnxdf8.mjs} +44 -26
  196. package/dist/esm/index-wqc43mw0.mjs +158 -0
  197. package/dist/esm/{index-ppspzgn9.mjs → index-x6r9bn12.mjs} +4026 -4761
  198. package/dist/esm/{index-vxwg66ar.mjs → index-xac20sv4.mjs} +44 -57
  199. package/dist/esm/index.mjs +4 -5
  200. package/dist/esm/internals.mjs +13 -13
  201. package/dist/esm/previewEntry.mjs +18 -15
  202. package/dist/esm/renderEntry.mjs +5 -1
  203. package/dist/helpers/calculate-timeline.d.ts +5 -1
  204. package/dist/helpers/calculate-timeline.js +1 -1
  205. package/dist/helpers/checkerboard-background.d.ts +2 -2
  206. package/dist/helpers/colors.d.ts +132 -112
  207. package/dist/helpers/colors.js +117 -95
  208. package/dist/helpers/create-folder-tree.js +2 -1
  209. package/dist/helpers/editor-guide-selection.d.ts +1 -1
  210. package/dist/helpers/editor-ruler.js +23 -12
  211. package/dist/helpers/get-connected-compositions.d.ts +6 -1
  212. package/dist/helpers/get-connected-compositions.js +1 -1
  213. package/dist/helpers/get-sequence-double-click-action.js +1 -1
  214. package/dist/helpers/get-sequence-visible-range.d.ts +1 -1
  215. package/dist/helpers/get-sequence-visible-range.js +2 -5
  216. package/dist/helpers/get-timeline-nestedness.d.ts +1 -1
  217. package/dist/helpers/get-timeline-nestedness.js +1 -1
  218. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -1
  219. package/dist/helpers/get-timeline-sequence-sort-key.js +1 -1
  220. package/dist/helpers/hoverable.js +4 -4
  221. package/dist/helpers/inject-css.js +5 -7
  222. package/dist/helpers/prism-vsc-dark-plus.d.ts +1 -1
  223. package/dist/helpers/prism-vsc-dark-plus.js +52 -51
  224. package/dist/helpers/resolve-studio-color.d.ts +1 -0
  225. package/dist/helpers/resolve-studio-color.js +11 -0
  226. package/dist/helpers/studio-css-variables.d.ts +1 -0
  227. package/dist/helpers/studio-css-variables.js +105 -0
  228. package/dist/helpers/studio-pixel-ratio.d.ts +1 -0
  229. package/dist/helpers/studio-pixel-ratio.js +7 -0
  230. package/dist/helpers/timeline-node-path-key.d.ts +1 -1
  231. package/dist/helpers/timeline-node-path-key.js +2 -2
  232. package/dist/helpers/use-runtime-values.js +2 -28
  233. package/dist/hot-middleware-client/client.js +5 -3
  234. package/dist/icons/align-center-horizontal.js +2 -1
  235. package/dist/icons/align-left.js +2 -1
  236. package/dist/icons/align-right.js +2 -1
  237. package/dist/icons/{separation.d.ts → background-removal.d.ts} +1 -1
  238. package/dist/icons/background-removal.js +9 -0
  239. package/dist/icons/wrap.d.ts +4 -0
  240. package/dist/icons/wrap.js +10 -0
  241. package/dist/previewEntry.js +2 -0
  242. package/dist/renderEntry.js +2 -0
  243. package/dist/state/modals.d.ts +15 -1
  244. package/dist/state/timeline-sequence-hover.d.ts +6 -16
  245. package/dist/state/timeline-sequence-hover.js +6 -67
  246. package/package.json +20 -19
  247. package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.d.ts +0 -15
  248. package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.js +0 -31
  249. package/dist/esm/LazyModels-nh3c8h9p.mjs +0 -12
  250. package/dist/esm/LazyModels-rr5v8h5y.mjs +0 -12
  251. package/dist/esm/index-cw0pnpg5.mjs +0 -50
  252. package/dist/esm/index-k426ye99.mjs +0 -139
  253. package/dist/helpers/get-box-quads-polyfill-internals.d.ts +0 -82
  254. package/dist/helpers/get-box-quads-polyfill-internals.js +0 -2403
  255. package/dist/helpers/get-box-quads-ponyfill.d.ts +0 -10
  256. package/dist/helpers/get-box-quads-ponyfill.js +0 -23
  257. package/dist/icons/separation.js +0 -7
  258. /package/dist/esm/{resolve-composition-component-location-qrp05g62.mjs → resolve-composition-component-location-2hgf6g0a.mjs} +0 -0
@@ -0,0 +1,433 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectedOutlinePathPoints = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const paths_1 = require("@remotion/paths");
6
+ const react_1 = require("react");
7
+ const remotion_1 = require("remotion");
8
+ const colors_1 = require("../helpers/colors");
9
+ const pointer_session_1 = require("../helpers/pointer-session");
10
+ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
11
+ const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
12
+ const SelectedOutlinePathPoints = ({ outline, pathDrag, onDraggingChange }) => {
13
+ const { setDragOverrides, clearDragOverrides, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
14
+ const { points, connections, implicitTControls } = (0, react_1.useMemo)(() => {
15
+ if (outline.path === null) {
16
+ return {
17
+ points: [],
18
+ connections: [],
19
+ implicitTControls: new Map(),
20
+ };
21
+ }
22
+ try {
23
+ const instructions = (0, paths_1.parsePath)((0, paths_1.normalizePath)(outline.path.d));
24
+ const pathPoints = [];
25
+ const pathConnections = [];
26
+ const pathImplicitTControls = new Map();
27
+ let x = 0;
28
+ let y = 0;
29
+ let subpathX = 0;
30
+ let subpathY = 0;
31
+ let previousCubicControl = null;
32
+ let previousQuadraticControl = null;
33
+ for (const [instructionIndex, instruction] of instructions.entries()) {
34
+ if (instruction.type === 'Z') {
35
+ x = subpathX;
36
+ y = subpathY;
37
+ previousCubicControl = null;
38
+ previousQuadraticControl = null;
39
+ continue;
40
+ }
41
+ if (instruction.type === 'C') {
42
+ pathConnections.push({
43
+ x1: x,
44
+ y1: y,
45
+ x2: instruction.cp1x,
46
+ y2: instruction.cp1y,
47
+ key: `${instructionIndex}-start-handle`,
48
+ }, {
49
+ x1: instruction.x,
50
+ y1: instruction.y,
51
+ x2: instruction.cp2x,
52
+ y2: instruction.cp2y,
53
+ key: `${instructionIndex}-end-handle`,
54
+ });
55
+ pathPoints.push({
56
+ x: instruction.cp1x,
57
+ y: instruction.cp1y,
58
+ key: `${instructionIndex}-cp1`,
59
+ instructionIndex,
60
+ role: 'cp1',
61
+ }, {
62
+ x: instruction.cp2x,
63
+ y: instruction.cp2y,
64
+ key: `${instructionIndex}-cp2`,
65
+ instructionIndex,
66
+ role: 'cp2',
67
+ });
68
+ previousCubicControl = { x: instruction.cp2x, y: instruction.cp2y };
69
+ previousQuadraticControl = null;
70
+ }
71
+ else if (instruction.type === 'S') {
72
+ if (previousCubicControl !== null) {
73
+ const reflectedX = 2 * x - previousCubicControl.x;
74
+ const reflectedY = 2 * y - previousCubicControl.y;
75
+ if (reflectedX !== x || reflectedY !== y) {
76
+ pathConnections.push({
77
+ x1: x,
78
+ y1: y,
79
+ x2: reflectedX,
80
+ y2: reflectedY,
81
+ key: `${instructionIndex}-start-handle`,
82
+ });
83
+ pathPoints.push({
84
+ x: reflectedX,
85
+ y: reflectedY,
86
+ key: `${instructionIndex}-reflected-cp`,
87
+ instructionIndex,
88
+ role: 'reflected-cp',
89
+ });
90
+ }
91
+ }
92
+ pathConnections.push({
93
+ x1: instruction.x,
94
+ y1: instruction.y,
95
+ x2: instruction.cpx,
96
+ y2: instruction.cpy,
97
+ key: `${instructionIndex}-end-handle`,
98
+ });
99
+ pathPoints.push({
100
+ x: instruction.cpx,
101
+ y: instruction.cpy,
102
+ key: `${instructionIndex}-cp`,
103
+ instructionIndex,
104
+ role: 'cp',
105
+ });
106
+ previousCubicControl = { x: instruction.cpx, y: instruction.cpy };
107
+ previousQuadraticControl = null;
108
+ }
109
+ else if (instruction.type === 'Q') {
110
+ pathConnections.push({
111
+ x1: x,
112
+ y1: y,
113
+ x2: instruction.cpx,
114
+ y2: instruction.cpy,
115
+ key: `${instructionIndex}-start-handle`,
116
+ }, {
117
+ x1: instruction.x,
118
+ y1: instruction.y,
119
+ x2: instruction.cpx,
120
+ y2: instruction.cpy,
121
+ key: `${instructionIndex}-end-handle`,
122
+ });
123
+ pathPoints.push({
124
+ x: instruction.cpx,
125
+ y: instruction.cpy,
126
+ key: `${instructionIndex}-cp`,
127
+ instructionIndex,
128
+ role: 'cp',
129
+ });
130
+ previousQuadraticControl = { x: instruction.cpx, y: instruction.cpy };
131
+ previousCubicControl = null;
132
+ }
133
+ else if (instruction.type === 'T') {
134
+ const control = previousQuadraticControl === null
135
+ ? { x, y }
136
+ : {
137
+ x: 2 * x - previousQuadraticControl.x,
138
+ y: 2 * y - previousQuadraticControl.y,
139
+ };
140
+ pathImplicitTControls.set(instructionIndex, control);
141
+ if (control.x !== x || control.y !== y) {
142
+ pathConnections.push({
143
+ x1: x,
144
+ y1: y,
145
+ x2: control.x,
146
+ y2: control.y,
147
+ key: `${instructionIndex}-start-handle`,
148
+ }, {
149
+ x1: instruction.x,
150
+ y1: instruction.y,
151
+ x2: control.x,
152
+ y2: control.y,
153
+ key: `${instructionIndex}-end-handle`,
154
+ });
155
+ pathPoints.push({
156
+ x: control.x,
157
+ y: control.y,
158
+ key: `${instructionIndex}-reflected-cp`,
159
+ instructionIndex,
160
+ role: 'reflected-cp',
161
+ });
162
+ }
163
+ previousQuadraticControl = control;
164
+ previousCubicControl = null;
165
+ }
166
+ else {
167
+ previousCubicControl = null;
168
+ previousQuadraticControl = null;
169
+ }
170
+ if (instruction.type === 'H') {
171
+ x = instruction.x;
172
+ }
173
+ else if (instruction.type === 'V') {
174
+ y = instruction.y;
175
+ }
176
+ else if ('x' in instruction && 'y' in instruction) {
177
+ x = instruction.x;
178
+ y = instruction.y;
179
+ }
180
+ if (instruction.type === 'M') {
181
+ subpathX = x;
182
+ subpathY = y;
183
+ }
184
+ pathPoints.push({
185
+ x,
186
+ y,
187
+ key: `${instructionIndex}-end`,
188
+ instructionIndex,
189
+ role: 'end',
190
+ });
191
+ }
192
+ const { a, b, c, d, e, f } = outline.path.matrix;
193
+ const transformPoint = (localX, localY) => ({
194
+ x: a * localX + c * localY + e,
195
+ y: b * localX + d * localY + f,
196
+ });
197
+ return {
198
+ points: pathPoints.map((point) => ({
199
+ ...transformPoint(point.x, point.y),
200
+ localX: point.x,
201
+ localY: point.y,
202
+ key: point.key,
203
+ instructionIndex: point.instructionIndex,
204
+ role: point.role,
205
+ })),
206
+ connections: pathConnections.map((connection) => {
207
+ const from = transformPoint(connection.x1, connection.y1);
208
+ const to = transformPoint(connection.x2, connection.y2);
209
+ return {
210
+ x1: from.x,
211
+ y1: from.y,
212
+ x2: to.x,
213
+ y2: to.y,
214
+ key: connection.key,
215
+ };
216
+ }),
217
+ implicitTControls: pathImplicitTControls,
218
+ };
219
+ }
220
+ catch (_a) {
221
+ return {
222
+ points: [],
223
+ connections: [],
224
+ implicitTControls: new Map(),
225
+ };
226
+ }
227
+ }, [outline.path]);
228
+ const onPointPointerDown = (event, point) => {
229
+ if (event.button !== 0 || outline.path === null) {
230
+ return;
231
+ }
232
+ const svg = event.currentTarget.ownerSVGElement;
233
+ if (svg === null) {
234
+ return;
235
+ }
236
+ const { a, b, c, d } = outline.path.matrix;
237
+ const determinant = a * d - b * c;
238
+ if (!Number.isFinite(determinant) || determinant === 0) {
239
+ return;
240
+ }
241
+ let instructions;
242
+ try {
243
+ instructions = (0, paths_1.parsePath)((0, paths_1.normalizePath)(outline.path.d));
244
+ }
245
+ catch (_a) {
246
+ return;
247
+ }
248
+ event.preventDefault();
249
+ event.stopPropagation();
250
+ onDraggingChange(true);
251
+ const startX = event.clientX;
252
+ const startY = event.clientY;
253
+ const originalD = (0, paths_1.serializeInstructions)(instructions);
254
+ let lastD = originalD;
255
+ (0, pointer_session_1.startCapturedPointerSession)({
256
+ event,
257
+ captureTarget: svg,
258
+ onMove: (moveEvent) => {
259
+ moveEvent.preventDefault();
260
+ const deltaX = moveEvent.clientX - startX;
261
+ const deltaY = moveEvent.clientY - startY;
262
+ const localDeltaX = Math.round(((d * deltaX - c * deltaY) / determinant) * 100) / 100;
263
+ const localDeltaY = Math.round(((a * deltaY - b * deltaX) / determinant) * 100) / 100;
264
+ if (localDeltaX === 0 && localDeltaY === 0) {
265
+ if (lastD !== originalD) {
266
+ lastD = originalD;
267
+ setDragOverrides(pathDrag.nodePath, 'd', remotion_1.Internals.makeStaticDragOverride(originalD));
268
+ }
269
+ return;
270
+ }
271
+ const nextX = localDeltaX === 0
272
+ ? point.localX
273
+ : Math.round((point.localX + localDeltaX) * 100) / 100;
274
+ const nextY = localDeltaY === 0
275
+ ? point.localY
276
+ : Math.round((point.localY + localDeltaY) * 100) / 100;
277
+ const translatedX = (value) => nextX === point.localX
278
+ ? value
279
+ : Math.round((value + nextX - point.localX) * 100) / 100;
280
+ const translatedY = (value) => nextY === point.localY
281
+ ? value
282
+ : Math.round((value + nextY - point.localY) * 100) / 100;
283
+ const instruction = instructions[point.instructionIndex];
284
+ if (instruction === undefined) {
285
+ return;
286
+ }
287
+ let updated;
288
+ if (point.role === 'end') {
289
+ if (instruction.type === 'H') {
290
+ updated =
291
+ nextY === point.localY
292
+ ? { ...instruction, x: nextX }
293
+ : { type: 'L', x: nextX, y: nextY };
294
+ }
295
+ else if (instruction.type === 'V') {
296
+ updated =
297
+ nextX === point.localX
298
+ ? { ...instruction, y: nextY }
299
+ : { type: 'L', x: nextX, y: nextY };
300
+ }
301
+ else if (instruction.type === 'C') {
302
+ updated = {
303
+ ...instruction,
304
+ cp2x: translatedX(instruction.cp2x),
305
+ cp2y: translatedY(instruction.cp2y),
306
+ x: nextX,
307
+ y: nextY,
308
+ };
309
+ }
310
+ else if (instruction.type === 'S' || instruction.type === 'Q') {
311
+ updated = {
312
+ ...instruction,
313
+ cpx: translatedX(instruction.cpx),
314
+ cpy: translatedY(instruction.cpy),
315
+ x: nextX,
316
+ y: nextY,
317
+ };
318
+ }
319
+ else if (instruction.type === 'T') {
320
+ const control = implicitTControls.get(point.instructionIndex);
321
+ if (control === undefined) {
322
+ return;
323
+ }
324
+ updated = {
325
+ type: 'Q',
326
+ cpx: translatedX(control.x),
327
+ cpy: translatedY(control.y),
328
+ x: nextX,
329
+ y: nextY,
330
+ };
331
+ }
332
+ else if ('x' in instruction && 'y' in instruction) {
333
+ updated = { ...instruction, x: nextX, y: nextY };
334
+ }
335
+ else {
336
+ return;
337
+ }
338
+ }
339
+ else if (point.role === 'cp1' && instruction.type === 'C') {
340
+ updated = { ...instruction, cp1x: nextX, cp1y: nextY };
341
+ }
342
+ else if (point.role === 'cp2' && instruction.type === 'C') {
343
+ updated = { ...instruction, cp2x: nextX, cp2y: nextY };
344
+ }
345
+ else if (point.role === 'cp' &&
346
+ (instruction.type === 'Q' || instruction.type === 'S')) {
347
+ updated = { ...instruction, cpx: nextX, cpy: nextY };
348
+ }
349
+ else if (point.role === 'reflected-cp' && instruction.type === 'S') {
350
+ updated = {
351
+ type: 'C',
352
+ cp1x: nextX,
353
+ cp1y: nextY,
354
+ cp2x: instruction.cpx,
355
+ cp2y: instruction.cpy,
356
+ x: instruction.x,
357
+ y: instruction.y,
358
+ };
359
+ }
360
+ else if (point.role === 'reflected-cp' && instruction.type === 'T') {
361
+ updated = {
362
+ type: 'Q',
363
+ cpx: nextX,
364
+ cpy: nextY,
365
+ x: instruction.x,
366
+ y: instruction.y,
367
+ };
368
+ }
369
+ else {
370
+ return;
371
+ }
372
+ const nextInstructions = instructions.slice();
373
+ nextInstructions[point.instructionIndex] = updated;
374
+ if (point.role === 'end') {
375
+ const nextInstruction = instructions[point.instructionIndex + 1];
376
+ if ((nextInstruction === null || nextInstruction === void 0 ? void 0 : nextInstruction.type) === 'C') {
377
+ nextInstructions[point.instructionIndex + 1] = {
378
+ ...nextInstruction,
379
+ cp1x: translatedX(nextInstruction.cp1x),
380
+ cp1y: translatedY(nextInstruction.cp1y),
381
+ };
382
+ }
383
+ else if ((nextInstruction === null || nextInstruction === void 0 ? void 0 : nextInstruction.type) === 'Q') {
384
+ nextInstructions[point.instructionIndex + 1] = {
385
+ ...nextInstruction,
386
+ cpx: translatedX(nextInstruction.cpx),
387
+ cpy: translatedY(nextInstruction.cpy),
388
+ };
389
+ }
390
+ }
391
+ const nextD = (0, paths_1.serializeInstructions)(nextInstructions);
392
+ if (lastD === nextD) {
393
+ return;
394
+ }
395
+ lastD = nextD;
396
+ setDragOverrides(pathDrag.nodePath, 'd', remotion_1.Internals.makeStaticDragOverride(nextD));
397
+ },
398
+ onEnd: (reason, endEvent) => {
399
+ onDraggingChange(false);
400
+ if (!(0, pointer_session_1.isPointerSessionRelease)(reason, endEvent) || lastD === originalD) {
401
+ clearDragOverrides(pathDrag.nodePath);
402
+ return;
403
+ }
404
+ (0, save_sequence_prop_1.saveSequenceProps)({
405
+ changes: [
406
+ {
407
+ fileName: pathDrag.nodePath.absolutePath,
408
+ nodePath: pathDrag.nodePath,
409
+ fieldKey: 'd',
410
+ value: lastD,
411
+ defaultValue: null,
412
+ schema: pathDrag.schema,
413
+ },
414
+ ],
415
+ addedKeyframes: null,
416
+ movedKeyframes: null,
417
+ setPropStatuses,
418
+ clientId: pathDrag.clientId,
419
+ undoLabel: 'Edit path point',
420
+ redoLabel: 'Edit path point back',
421
+ })
422
+ .catch((error) => {
423
+ (0, NotificationCenter_1.showNotification)(`Could not save path: ${error instanceof Error ? error.message : String(error)}`, 3000);
424
+ })
425
+ .finally(() => clearDragOverrides(pathDrag.nodePath));
426
+ },
427
+ });
428
+ };
429
+ return (jsx_runtime_1.jsxs("g", { children: [connections.map((connection) => (jsx_runtime_1.jsx("line", { x1: connection.x1, y1: connection.y1, x2: connection.x2, y2: connection.y2, stroke: colors_1.BLUE, strokeWidth: 2, pointerEvents: "none" }, connection.key))), points.map((point) => (jsx_runtime_1.jsxs("g", { children: [
430
+ jsx_runtime_1.jsx("circle", { cx: point.x, cy: point.y, r: 10, fill: "transparent", pointerEvents: "all", onPointerDown: (event) => onPointPointerDown(event, point), style: { cursor: 'pointer' } }), jsx_runtime_1.jsx("circle", { cx: point.x, cy: point.y, r: 4.5, fill: colors_1.WHITE, stroke: colors_1.BLUE, strokeWidth: 2, pointerEvents: "none" })
431
+ ] }, point.key)))] }));
432
+ };
433
+ exports.SelectedOutlinePathPoints = SelectedOutlinePathPoints;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SelectedOutlinePolygon = exports.SELECTED_OUTLINE_KEY_ATTR = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const canvas_1 = require("@remotion/canvas");
38
39
  const react_1 = __importStar(require("react"));
39
40
  const remotion_1 = require("remotion");
40
41
  const client_id_1 = require("../helpers/client-id");
@@ -49,7 +50,6 @@ const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
49
50
  const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
50
51
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
51
52
  const selected_outline_drag_1 = require("./selected-outline-drag");
52
- const selected_outline_measurement_1 = require("./selected-outline-measurement");
53
53
  const selected_outline_snap_1 = require("./selected-outline-snap");
54
54
  const selected_outline_types_1 = require("./selected-outline-types");
55
55
  const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
@@ -57,6 +57,8 @@ const focus_inspector_field_1 = require("./Timeline/focus-inspector-field");
57
57
  const imperative_state_1 = require("./Timeline/imperative-state");
58
58
  const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
59
59
  const should_clear_selection_on_pointer_down_1 = require("./Timeline/should-clear-selection-on-pointer-down");
60
+ const TimelineSelection_1 = require("./Timeline/TimelineSelection");
61
+ const { CanvasOutlinePolygon, handleCanvasOutlinePointerDown } = canvas_1.CanvasInternals;
60
62
  exports.SELECTED_OUTLINE_KEY_ATTR = 'data-remotion-studio-selected-outline-key';
61
63
  const SelectedOutlinePolygonUnmemoized = ({ compositionHeight, compositionWidth, containsSelection, directlySelected, dragging, getAllDragOutlines, getAllDragTargets, getLayoutTarget, getTarget, hasTarget, hovered, outline, onDraggingChange, onHoverChange, onSnapPointsChange, onSelect, onDoubleClickTarget, scale, showSelectedOutline, translateWithCommandKey, }) => {
62
64
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
@@ -67,7 +69,7 @@ const SelectedOutlinePolygonUnmemoized = ({ compositionHeight, compositionWidth,
67
69
  const { editorSnapping } = (0, react_1.useContext)(editor_snapping_1.EditorSnappingContext);
68
70
  const { editorShowGuides, guidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
69
71
  const polygonRef = (0, react_1.useRef)(null);
70
- const points = (0, react_1.useMemo)(() => outline.points.map(selected_outline_measurement_1.pointToString).join(' '), [outline.points]);
72
+ const { selectItems } = (0, TimelineSelection_1.useTimelineSelection)();
71
73
  const [effectDropHovered, setEffectDropHovered] = (0, react_1.useState)(false);
72
74
  const visible = showSelectedOutline || hovered;
73
75
  const getEffectDropTarget = react_1.default.useCallback(() => {
@@ -84,45 +86,26 @@ const SelectedOutlinePolygonUnmemoized = ({ compositionHeight, compositionWidth,
84
86
  return {
85
87
  clientId: previewServerState.clientId,
86
88
  fileName: nodePath.absolutePath,
87
- nodePath,
89
+ nodePathInfo: target.nodePathInfo,
88
90
  };
89
91
  }, [getLayoutTarget, previewServerState]);
90
92
  const onPointerDown = react_1.default.useCallback((event) => {
91
93
  var _a;
92
94
  const target = getTarget();
93
- if (event.button !== 0 || target === undefined) {
95
+ const decision = handleCanvasOutlinePointerDown({
96
+ event,
97
+ polygon: polygonRef.current,
98
+ hasTarget: target !== undefined,
99
+ selected: (_a = target === null || target === void 0 ? void 0 : target.selected) !== null && _a !== void 0 ? _a : false,
100
+ containsSelection,
101
+ translateWithCommandKey,
102
+ isMac: is_mac_1.isMac,
103
+ });
104
+ if (decision === null || target === undefined) {
94
105
  return;
95
106
  }
96
- const { drag, selected } = target;
97
- event.preventDefault();
98
- event.stopPropagation();
99
- const temporaryTranslate = translateWithCommandKey &&
100
- (selected || containsSelection) &&
101
- (is_mac_1.isMac ? event.metaKey : event.ctrlKey);
102
- const interaction = temporaryTranslate
103
- ? { shiftKey: false, toggleKey: false }
104
- : (0, selected_outline_measurement_1.getOutlineSelectionInteraction)(event);
105
- const shouldUpdateSelection = !selected || interaction.shiftKey || interaction.toggleKey;
106
- const ownerSvg = (_a = polygonRef.current) === null || _a === void 0 ? void 0 : _a.ownerSVGElement;
107
- let pointerInsideSelectedOutline = false;
108
- if (ownerSvg) {
109
- const screenPoint = ownerSvg.createSVGPoint();
110
- screenPoint.x = event.clientX;
111
- screenPoint.y = event.clientY;
112
- pointerInsideSelectedOutline = Array.from(ownerSvg.querySelectorAll('polygon[data-remotion-directly-selected-outline="true"]')).some((selectedPolygon) => {
113
- const screenTransform = selectedPolygon.getScreenCTM();
114
- if (screenTransform === null) {
115
- return false;
116
- }
117
- const polygonPoint = screenPoint.matrixTransform(screenTransform.inverse());
118
- return (selectedPolygon.isPointInFill(polygonPoint) ||
119
- selectedPolygon.isPointInStroke(polygonPoint));
120
- });
121
- }
122
- const deferSelection = !selected &&
123
- !interaction.shiftKey &&
124
- !interaction.toggleKey &&
125
- (containsSelection || pointerInsideSelectedOutline);
107
+ const { drag } = target;
108
+ const { interaction, temporaryTranslate, shouldUpdateSelection, deferSelection, dragExistingSelection, } = decision;
126
109
  if (!deferSelection && shouldUpdateSelection) {
127
110
  onSelect(target.selection, interaction);
128
111
  }
@@ -139,7 +122,6 @@ const SelectedOutlinePolygonUnmemoized = ({ compositionHeight, compositionWidth,
139
122
  }
140
123
  const startPointerX = event.clientX;
141
124
  const startPointerY = event.clientY;
142
- const dragExistingSelection = selected || deferSelection;
143
125
  const dragTargets = dragExistingSelection
144
126
  ? getAllDragTargets()
145
127
  : drag === null
@@ -407,18 +389,11 @@ const SelectedOutlinePolygonUnmemoized = ({ compositionHeight, compositionWidth,
407
389
  await (0, effect_drag_and_drop_1.addEffectFromDragData)({
408
390
  dragData,
409
391
  fileName: effectDrop.fileName,
410
- nodePath: effectDrop.nodePath,
392
+ nodePathInfo: effectDrop.nodePathInfo,
411
393
  clientId: effectDrop.clientId,
394
+ selectItems,
412
395
  });
413
- }, [getEffectDropTarget]);
414
- return (jsx_runtime_1.jsx("polygon", { ref: polygonRef, [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', [exports.SELECTED_OUTLINE_KEY_ATTR]: outline.key, "data-remotion-directly-selected-outline": directlySelected ? 'true' : undefined, points: points, fill: effectDropHovered ? colors_1.TIMELINE_DROP_BLUE_ALPHA_12 : colors_1.TRANSPARENT, stroke: colors_1.BLUE, strokeOpacity: visible || effectDropHovered ? 1 : 0, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: hasTarget ? 'all' : undefined, onPointerEnter: () => {
415
- if (!dragging) {
416
- onHoverChange(outline.key);
417
- }
418
- }, onPointerLeave: () => {
419
- if (!dragging) {
420
- onHoverChange(null);
421
- }
422
- }, onPointerDown: onPointerDown, onPointerDownCapture: dragAwareDoubleClick.beginPointerGesture, onClick: onClick, onDragOver: onEffectDragOver, onDragLeave: onEffectDragLeave, onDrop: onEffectDrop }));
396
+ }, [getEffectDropTarget, selectItems]);
397
+ return (jsx_runtime_1.jsx(CanvasOutlinePolygon, { ref: polygonRef, [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', [exports.SELECTED_OUTLINE_KEY_ATTR]: outline.key, outline: outline, directlySelected: directlySelected, dragging: dragging, fill: effectDropHovered ? colors_1.TIMELINE_DROP_BLUE_ALPHA_12 : colors_1.TRANSPARENT, stroke: colors_1.BLUE, visible: visible || effectDropHovered, interactive: hasTarget, onHoverChange: onHoverChange, onPointerDown: onPointerDown, onPointerDownCapture: dragAwareDoubleClick.beginPointerGesture, onClick: onClick, onDragOver: onEffectDragOver, onDragLeave: onEffectDragLeave, onDrop: onEffectDrop }));
423
398
  };
424
399
  exports.SelectedOutlinePolygon = react_1.default.memo(SelectedOutlinePolygonUnmemoized);
@@ -1,18 +1,16 @@
1
1
  import React from 'react';
2
- import type { SelectedOutlineLayoutTarget, SelectedOutlineTarget } from './selected-outline-types';
2
+ import type { SelectedOutlineDragTarget, SelectedOutlineLayoutTarget, SelectedOutlineTarget } from './selected-outline-types';
3
3
  export declare const SelectedOutlineRenderer: React.NamedExoticComponent<{
4
4
  readonly compositionHeight: number;
5
5
  readonly compositionWidth: number;
6
6
  readonly dragging: boolean;
7
+ readonly getAllDragTargets: () => readonly SelectedOutlineDragTarget[];
7
8
  readonly getLatestOutlineTargetByKey: (key: string) => SelectedOutlineTarget | undefined;
8
9
  readonly outlineTargets: readonly SelectedOutlineLayoutTarget[];
9
10
  readonly onDraggingChange: (dragging: boolean) => void;
10
11
  readonly onContextMenuOpenChange: (open: boolean) => void;
11
12
  readonly onSelect: (item: import("@remotion/canvas").CanvasSelectionItem, interaction?: import("@remotion/canvas").CanvasSelectionInteraction | undefined) => void;
12
13
  readonly scale: number;
13
- readonly sequences: readonly {
14
- readonly id: string;
15
- readonly parent: string | null;
16
- }[];
14
+ readonly sequences: readonly import("@remotion/canvas").CanvasOutlineSequenceParent[];
17
15
  readonly updateOutlinesRef: React.MutableRefObject<() => void>;
18
16
  }>;