@remotion/studio 4.0.476 → 4.0.478
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/Canvas.js +40 -1
- package/dist/components/CanvasIfSizeIsAvailable.js +2 -6
- package/dist/components/ControlButton.d.ts +1 -0
- package/dist/components/ControlButton.js +7 -2
- package/dist/components/EditorGuides/Guide.js +151 -21
- package/dist/components/EditorRuler/Ruler.js +20 -24
- package/dist/components/EditorRuler/index.js +26 -13
- package/dist/components/InlineAction.js +1 -0
- package/dist/components/MenuToolbar.d.ts +1 -0
- package/dist/components/MenuToolbar.js +4 -1
- package/dist/components/OutlineToggle.js +1 -1
- package/dist/components/SelectedOutlineElement.d.ts +17 -0
- package/dist/components/SelectedOutlineElement.js +1009 -0
- package/dist/components/SelectedOutlineOverlay.d.ts +4 -210
- package/dist/components/SelectedOutlineOverlay.js +68 -1637
- package/dist/components/SelectedOutlineUvControls.js +1 -1
- package/dist/components/ShowGuidesProvider.js +4 -4
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
- package/dist/components/Timeline/Timeline.js +3 -1
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +9 -10
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +15 -4
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +7 -11
- package/dist/components/Timeline/TimelineList.js +1 -1
- package/dist/components/Timeline/TimelineSelection.d.ts +27 -13
- package/dist/components/Timeline/TimelineSelection.js +47 -28
- package/dist/components/Timeline/TimelineSequence.js +156 -3
- package/dist/components/Timeline/TimelineSequenceFrame.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceFrame.js +17 -6
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +90 -130
- package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
- package/dist/components/Timeline/TimelineVideoInfo.js +93 -8
- package/dist/components/Timeline/delete-selected-timeline-item.js +4 -0
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +8 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +32 -3
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +20 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.js +160 -0
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +11 -3
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +2 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +16 -2
- package/dist/components/Timeline/timeline-video-filmstrip-times.d.ts +17 -0
- package/dist/components/Timeline/timeline-video-filmstrip-times.js +22 -0
- package/dist/components/Timeline/update-selected-easing.d.ts +4 -6
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +3 -1
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +37 -1
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +282 -1
- package/dist/components/import-assets.d.ts +45 -8
- package/dist/components/import-assets.js +227 -12
- package/dist/components/selected-outline-drag.d.ts +140 -0
- package/dist/components/selected-outline-drag.js +475 -0
- package/dist/components/selected-outline-measurement.d.ts +67 -0
- package/dist/components/selected-outline-measurement.js +355 -0
- package/dist/components/selected-outline-types.d.ts +121 -0
- package/dist/components/selected-outline-types.js +15 -0
- package/dist/components/selected-outline-uv.d.ts +1 -0
- package/dist/components/selected-outline-uv.js +12 -0
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -0
- package/dist/esm/{chunk-0atarw3p.js → chunk-hrw9799x.js} +12812 -11386
- package/dist/esm/internals.mjs +12812 -11386
- package/dist/esm/previewEntry.mjs +21059 -19629
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/editor-guide-selection.d.ts +31 -0
- package/dist/helpers/editor-guide-selection.js +58 -0
- package/dist/helpers/editor-ruler.d.ts +3 -3
- package/dist/helpers/editor-ruler.js +16 -18
- package/dist/helpers/get-preview-file-type.js +1 -1
- package/dist/helpers/ruler-canvas-size.d.ts +5 -0
- package/dist/helpers/ruler-canvas-size.js +17 -0
- package/dist/state/editor-guides.d.ts +2 -2
- package/dist/state/editor-guides.js +2 -2
- package/package.json +11 -11
|
@@ -33,1633 +33,64 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SelectedOutlineOverlay = exports.
|
|
36
|
+
exports.SelectedOutlineOverlay = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineTransformOriginLockedAxis = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineTransformOriginAxisLock = exports.applySelectedOutlineDragAxisLock = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const player_1 = require("@remotion/player");
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const remotion_1 = require("remotion");
|
|
41
41
|
const no_react_1 = require("remotion/no-react");
|
|
42
|
-
const calculate_timeline_1 = require("../helpers/calculate-timeline");
|
|
43
42
|
const client_id_1 = require("../helpers/client-id");
|
|
44
|
-
const colors_1 = require("../helpers/colors");
|
|
45
|
-
const format_file_location_1 = require("../helpers/format-file-location");
|
|
46
|
-
const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
|
|
47
|
-
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
48
43
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
49
44
|
const editor_outlines_1 = require("../state/editor-outlines");
|
|
50
45
|
const scale_lock_1 = require("../state/scale-lock");
|
|
51
|
-
const ContextMenu_1 = require("./ContextMenu");
|
|
52
|
-
const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
53
|
-
const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
|
|
54
46
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
55
|
-
const
|
|
47
|
+
const selected_outline_drag_1 = require("./selected-outline-drag");
|
|
48
|
+
const selected_outline_measurement_1 = require("./selected-outline-measurement");
|
|
49
|
+
const selected_outline_types_1 = require("./selected-outline-types");
|
|
56
50
|
const selected_outline_uv_1 = require("./selected-outline-uv");
|
|
51
|
+
const SelectedOutlineElement_1 = require("./SelectedOutlineElement");
|
|
57
52
|
const SelectedOutlineUvControls_1 = require("./SelectedOutlineUvControls");
|
|
58
53
|
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
59
|
-
const disable_sequence_interactivity_1 = require("./Timeline/disable-sequence-interactivity");
|
|
60
54
|
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
61
|
-
const parse_keyframe_field_from_node_path_1 = require("./Timeline/parse-keyframe-field-from-node-path");
|
|
62
55
|
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
63
|
-
const timeline_field_utils_1 = require("./Timeline/timeline-field-utils");
|
|
64
|
-
const timeline_rotation_utils_1 = require("./Timeline/timeline-rotation-utils");
|
|
65
56
|
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
66
|
-
const timeline_translate_utils_1 = require("./Timeline/timeline-translate-utils");
|
|
67
|
-
const TimelineScaleField_1 = require("./Timeline/TimelineScaleField");
|
|
68
57
|
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
exports.
|
|
58
|
+
const selected_outline_drag_2 = require("./selected-outline-drag");
|
|
59
|
+
Object.defineProperty(exports, "applySelectedOutlineDragAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineDragAxisLock; } });
|
|
60
|
+
Object.defineProperty(exports, "applySelectedOutlineTransformOriginAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineTransformOriginAxisLock; } });
|
|
61
|
+
Object.defineProperty(exports, "compensateTranslateForTransformOrigin", { enumerable: true, get: function () { return selected_outline_drag_2.compensateTranslateForTransformOrigin; } });
|
|
62
|
+
Object.defineProperty(exports, "getSelectedOutlineDragChanges", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineDragChanges; } });
|
|
63
|
+
Object.defineProperty(exports, "getSelectedOutlineDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineDragValues; } });
|
|
64
|
+
Object.defineProperty(exports, "getSelectedOutlineKeyboardNudgeDelta", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineKeyboardNudgeDelta; } });
|
|
65
|
+
Object.defineProperty(exports, "getSelectedOutlineKeyboardNudgeDeltas", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineKeyboardNudgeDeltas; } });
|
|
66
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationDragChanges", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineRotationDragChanges; } });
|
|
67
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationDragStates", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineRotationDragStates; } });
|
|
68
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineRotationDragValues; } });
|
|
69
|
+
Object.defineProperty(exports, "getSelectedOutlineScaleDragChanges", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleDragChanges; } });
|
|
70
|
+
Object.defineProperty(exports, "getSelectedOutlineScaleDragStates", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleDragStates; } });
|
|
71
|
+
Object.defineProperty(exports, "getSelectedOutlineScaleDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleDragValues; } });
|
|
72
|
+
Object.defineProperty(exports, "getSelectedOutlineScaleEdgeInfo", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleEdgeInfo; } });
|
|
73
|
+
Object.defineProperty(exports, "getSelectedOutlineTransformOriginLockedAxis", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineTransformOriginLockedAxis; } });
|
|
74
|
+
Object.defineProperty(exports, "isSelectedOutlineDragPastThreshold", { enumerable: true, get: function () { return selected_outline_drag_2.isSelectedOutlineDragPastThreshold; } });
|
|
75
|
+
Object.defineProperty(exports, "selectedOutlineTransformOriginSnapThresholdPx", { enumerable: true, get: function () { return selected_outline_drag_2.selectedOutlineTransformOriginSnapThresholdPx; } });
|
|
76
|
+
Object.defineProperty(exports, "snapSelectedOutlineTransformOriginUv", { enumerable: true, get: function () { return selected_outline_drag_2.snapSelectedOutlineTransformOriginUv; } });
|
|
77
|
+
const selected_outline_measurement_2 = require("./selected-outline-measurement");
|
|
78
|
+
Object.defineProperty(exports, "getOutlineSelectionInteraction", { enumerable: true, get: function () { return selected_outline_measurement_2.getOutlineSelectionInteraction; } });
|
|
79
|
+
Object.defineProperty(exports, "getSelectedEffectFieldsBySequenceKey", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedEffectFieldsBySequenceKey; } });
|
|
80
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationCornerInfo", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedOutlineRotationCornerInfo; } });
|
|
81
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationDeltaDegrees", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedOutlineRotationDeltaDegrees; } });
|
|
82
|
+
Object.defineProperty(exports, "getSelectedOutlineRotationPivot", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedOutlineRotationPivot; } });
|
|
83
|
+
Object.defineProperty(exports, "getSelectedSequenceKeys", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedSequenceKeys; } });
|
|
84
|
+
Object.defineProperty(exports, "getSequencesWithSelectableOutlines", { enumerable: true, get: function () { return selected_outline_measurement_2.getSequencesWithSelectableOutlines; } });
|
|
85
|
+
Object.defineProperty(exports, "getTransformedSvgViewportPoints", { enumerable: true, get: function () { return selected_outline_measurement_2.getTransformedSvgViewportPoints; } });
|
|
86
|
+
const selected_outline_types_2 = require("./selected-outline-types");
|
|
87
|
+
Object.defineProperty(exports, "selectedOutlineDragThresholdPx", { enumerable: true, get: function () { return selected_outline_types_2.selectedOutlineDragThresholdPx; } });
|
|
76
88
|
const outlineContainer = {
|
|
77
89
|
position: 'absolute',
|
|
78
90
|
inset: 0,
|
|
79
91
|
pointerEvents: 'none',
|
|
80
92
|
overflow: 'visible',
|
|
81
93
|
};
|
|
82
|
-
const emptyContextMenuValues = [];
|
|
83
|
-
const pointToString = (point) => `${point.x},${point.y}`;
|
|
84
|
-
const midpoint = (from, to) => {
|
|
85
|
-
return (0, selected_outline_geometry_1.mixPoint)(from, to, 0.5);
|
|
86
|
-
};
|
|
87
|
-
const getOutlineCenter = (points) => {
|
|
88
|
-
const [tl, tr, br, bl] = points;
|
|
89
|
-
return {
|
|
90
|
-
x: (tl.x + tr.x + br.x + bl.x) / 4,
|
|
91
|
-
y: (tl.y + tr.y + br.y + bl.y) / 4,
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
const dot = (left, right) => {
|
|
95
|
-
return left.x * right.x + left.y * right.y;
|
|
96
|
-
};
|
|
97
|
-
const vectorLength = (vector) => {
|
|
98
|
-
return Math.hypot(vector.x, vector.y);
|
|
99
|
-
};
|
|
100
|
-
const vectorBetween = (from, to) => {
|
|
101
|
-
return { x: to.x - from.x, y: to.y - from.y };
|
|
102
|
-
};
|
|
103
|
-
const getAngleDegrees = (from, to) => {
|
|
104
|
-
return Math.atan2(to.y - from.y, to.x - from.x) * (180 / Math.PI);
|
|
105
|
-
};
|
|
106
|
-
const getSelectedOutlineRotationDeltaDegrees = ({ from, to, }) => {
|
|
107
|
-
return ((((to - from) % 360) + 540) % 360) - 180;
|
|
108
|
-
};
|
|
109
|
-
exports.getSelectedOutlineRotationDeltaDegrees = getSelectedOutlineRotationDeltaDegrees;
|
|
110
|
-
const normalizeRotationCursorDegrees = (rotation) => {
|
|
111
|
-
const normalizedRotation = ((rotation % 360) + 360) % 360;
|
|
112
|
-
return Number(normalizedRotation.toFixed(3));
|
|
113
|
-
};
|
|
114
|
-
const getRotationCursor = (rotation) => {
|
|
115
|
-
const normalizedRotation = normalizeRotationCursorDegrees(rotation);
|
|
116
|
-
const transform = normalizedRotation === 0
|
|
117
|
-
? ''
|
|
118
|
-
: `<g transform="rotate(${normalizedRotation} 32 32)">`;
|
|
119
|
-
const transformEnd = normalizedRotation === 0 ? '' : '</g>';
|
|
120
|
-
const svg = `<svg width="24" height="24" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">${transform}<g transform="scale(0.876712329)" filter="url(#filter0_d_1_14)"><path d="M10.9111 17.7687C10.3413 18.3701 10.367 19.3195 10.9684 19.8893L20.7687 29.1738C21.3701 29.7436 22.3195 29.7179 22.8893 29.1165C23.459 28.5151 23.4334 27.5657 22.832 26.996L14.1206 18.7431L22.3735 10.0316C22.9432 9.43022 22.9176 8.48082 22.3162 7.91107C21.7148 7.34133 20.7654 7.36699 20.1956 7.96839L10.9111 17.7687ZM49.3923 58.3118C49.9509 58.9235 50.8996 58.9667 51.5114 58.4081L61.481 49.3055C62.0927 48.7469 62.1359 47.7981 61.5773 47.1863C61.0187 46.5745 60.0699 46.5314 59.4581 47.09L50.5963 55.1812L42.5051 46.3194C41.9465 45.7076 40.9977 45.6645 40.386 46.2231C39.7742 46.7817 39.7311 47.7304 40.2896 48.3422L49.3923 58.3118ZM12.6747 18.7431L13 19.8893C22.1283 19.6426 30.7584 21.4283 37.8564 26.6927C44.8518 31.8809 49.734 39.8538 49 56H50.5963H51.5114C52.2774 39.1461 47.6482 30.2198 39.6436 24.2831C31.7416 18.4224 22.3717 17.2467 13 17.5L12.6747 18.7431Z" fill="black"/><path d="M19.1064 6.93652C20.2459 5.73379 22.1448 5.68278 23.3477 6.82227C24.5505 7.96181 24.6022 9.86076 23.4629 11.0635L18.7373 16.0508C26.3487 16.4239 33.9128 18.1651 40.5371 23.0781C44.7339 26.1907 48.0794 30.1189 50.2568 35.4834C51.9666 39.6958 52.9327 44.7395 53.0742 50.8867L58.4463 45.9824C59.6697 44.8654 61.5673 44.9514 62.6846 46.1748C63.8018 47.3985 63.7155 49.296 62.4922 50.4131L52.5225 59.5156C51.337 60.5979 49.5196 60.5507 48.3916 59.4346L48.2842 59.3232L39.1816 49.3535C38.0648 48.1301 38.1507 46.2324 39.374 45.1152C40.5975 43.9979 42.4961 44.0841 43.6133 45.3076L47.4756 49.5381C47.1908 44.7613 46.2876 40.9448 44.9482 37.8291C43.0666 33.4521 40.2851 30.3614 36.9629 27.8975C31.8259 24.0875 25.8071 22.1663 19.2891 21.5732L23.8633 25.9072C25.0662 27.0468 25.1178 28.9457 23.9785 30.1484C22.8746 31.3135 21.0576 31.3982 19.8516 30.3662L19.7373 30.2627L9.93652 20.9785C8.73384 19.839 8.6828 17.9401 9.82227 16.7373L19.1064 6.93652Z" stroke="white" stroke-width="3"/></g>${transformEnd}<defs><filter id="filter0_d_1_14" x="0" y="0" width="72.4696" height="72.3004" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="3.75"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_14"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_14" result="shape"/></filter></defs></svg>`;
|
|
121
|
-
return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, alias`;
|
|
122
|
-
};
|
|
123
|
-
const rotationCursorBaseDegrees = {
|
|
124
|
-
'top-left': 270,
|
|
125
|
-
'top-right': 0,
|
|
126
|
-
'bottom-right': 90,
|
|
127
|
-
'bottom-left': 180,
|
|
128
|
-
};
|
|
129
|
-
const getOutlineRotationDegrees = (points) => {
|
|
130
|
-
const [tl, tr] = points;
|
|
131
|
-
return getAngleDegrees(tl, tr);
|
|
132
|
-
};
|
|
133
|
-
const getRotationCursorDegrees = (points, corner) => normalizeRotationCursorDegrees(getOutlineRotationDegrees(points) + rotationCursorBaseDegrees[corner]);
|
|
134
|
-
const getSelectedOutlineRotationCornerInfo = (points, corner) => {
|
|
135
|
-
const [tl, tr, br, bl] = points;
|
|
136
|
-
const point = {
|
|
137
|
-
'top-left': tl,
|
|
138
|
-
'top-right': tr,
|
|
139
|
-
'bottom-right': br,
|
|
140
|
-
'bottom-left': bl,
|
|
141
|
-
}[corner];
|
|
142
|
-
const center = getOutlineCenter(points);
|
|
143
|
-
const cursorDegrees = getRotationCursorDegrees(points, corner);
|
|
144
|
-
return {
|
|
145
|
-
center,
|
|
146
|
-
cursor: getRotationCursor(cursorDegrees),
|
|
147
|
-
cursorDegrees,
|
|
148
|
-
point,
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
exports.getSelectedOutlineRotationCornerInfo = getSelectedOutlineRotationCornerInfo;
|
|
152
|
-
const getSelectedOutlineRotationPivot = ({ dimensions, points, transformOriginValue, }) => {
|
|
153
|
-
if (dimensions === null) {
|
|
154
|
-
return getOutlineCenter(points);
|
|
155
|
-
}
|
|
156
|
-
const parsed = (0, transform_origin_utils_1.parseTransformOrigin)(transformOriginValue);
|
|
157
|
-
if (parsed === null) {
|
|
158
|
-
return getOutlineCenter(points);
|
|
159
|
-
}
|
|
160
|
-
const uv = (0, transform_origin_utils_1.parsedTransformOriginToUv)({
|
|
161
|
-
parsed,
|
|
162
|
-
width: dimensions.width,
|
|
163
|
-
height: dimensions.height,
|
|
164
|
-
});
|
|
165
|
-
if (uv === null) {
|
|
166
|
-
return getOutlineCenter(points);
|
|
167
|
-
}
|
|
168
|
-
return (0, selected_outline_uv_1.getUvHandlePosition)(points, uv);
|
|
169
|
-
};
|
|
170
|
-
exports.getSelectedOutlineRotationPivot = getSelectedOutlineRotationPivot;
|
|
171
|
-
const rectToPoints = (elementRect, containerRect) => {
|
|
172
|
-
const left = elementRect.left - containerRect.left;
|
|
173
|
-
const top = elementRect.top - containerRect.top;
|
|
174
|
-
const right = elementRect.right - containerRect.left;
|
|
175
|
-
const bottom = elementRect.bottom - containerRect.top;
|
|
176
|
-
return [
|
|
177
|
-
{ x: left, y: top },
|
|
178
|
-
{ x: right, y: top },
|
|
179
|
-
{ x: right, y: bottom },
|
|
180
|
-
{ x: left, y: bottom },
|
|
181
|
-
];
|
|
182
|
-
};
|
|
183
|
-
const getTransformedSvgViewportPoints = ({ viewport, ctm, containerRect, }) => {
|
|
184
|
-
const transformPoint = (x, y) => ({
|
|
185
|
-
x: ctm.a * x + ctm.c * y + ctm.e - containerRect.left,
|
|
186
|
-
y: ctm.b * x + ctm.d * y + ctm.f - containerRect.top,
|
|
187
|
-
});
|
|
188
|
-
const left = viewport.x;
|
|
189
|
-
const top = viewport.y;
|
|
190
|
-
const right = viewport.x + viewport.width;
|
|
191
|
-
const bottom = viewport.y + viewport.height;
|
|
192
|
-
return [
|
|
193
|
-
transformPoint(left, top),
|
|
194
|
-
transformPoint(right, top),
|
|
195
|
-
transformPoint(right, bottom),
|
|
196
|
-
transformPoint(left, bottom),
|
|
197
|
-
];
|
|
198
|
-
};
|
|
199
|
-
exports.getTransformedSvgViewportPoints = getTransformedSvgViewportPoints;
|
|
200
|
-
const quadToPoints = (quad, containerRect) => {
|
|
201
|
-
// `getBoxQuads`/the ponyfill returns the quad in viewport coordinates.
|
|
202
|
-
// The overlay <svg> is unscaled (the canvas `scale()`/pan live on a sibling
|
|
203
|
-
// container, not the svg), so 1 user unit == 1 px and we only need to move
|
|
204
|
-
// the quad into the svg's local space by subtracting its viewport origin.
|
|
205
|
-
// We deliberately do not pass `relativeTo` to the ponyfill: when the target
|
|
206
|
-
// is not an ancestor of the element, the polyfill cannot resolve the
|
|
207
|
-
// coordinate space and leaves the quad in viewport coordinates.
|
|
208
|
-
return [
|
|
209
|
-
{ x: quad.p1.x - containerRect.left, y: quad.p1.y - containerRect.top },
|
|
210
|
-
{ x: quad.p2.x - containerRect.left, y: quad.p2.y - containerRect.top },
|
|
211
|
-
{ x: quad.p3.x - containerRect.left, y: quad.p3.y - containerRect.top },
|
|
212
|
-
{ x: quad.p4.x - containerRect.left, y: quad.p4.y - containerRect.top },
|
|
213
|
-
];
|
|
214
|
-
};
|
|
215
|
-
const isSvgSvgElement = (element) => {
|
|
216
|
-
var _a;
|
|
217
|
-
const ownerSvgSvgElement = (_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.SVGSVGElement;
|
|
218
|
-
return ((typeof SVGSVGElement !== 'undefined' &&
|
|
219
|
-
element instanceof SVGSVGElement) ||
|
|
220
|
-
(ownerSvgSvgElement !== undefined && element instanceof ownerSvgSvgElement));
|
|
221
|
-
};
|
|
222
|
-
const getSvgSvgElementViewport = (element) => {
|
|
223
|
-
const viewBox = element.viewBox.baseVal;
|
|
224
|
-
if (viewBox.width > 0 && viewBox.height > 0) {
|
|
225
|
-
return {
|
|
226
|
-
x: viewBox.x,
|
|
227
|
-
y: viewBox.y,
|
|
228
|
-
width: viewBox.width,
|
|
229
|
-
height: viewBox.height,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
x: 0,
|
|
234
|
-
y: 0,
|
|
235
|
-
width: element.width.baseVal.value,
|
|
236
|
-
height: element.height.baseVal.value,
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
const getSvgSvgElementOutlinePoints = (element, containerRect) => {
|
|
240
|
-
const ctm = element.getScreenCTM();
|
|
241
|
-
const viewport = getSvgSvgElementViewport(element);
|
|
242
|
-
if (ctm === null || (viewport.width === 0 && viewport.height === 0)) {
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
return (0, exports.getTransformedSvgViewportPoints)({
|
|
246
|
-
viewport,
|
|
247
|
-
ctm,
|
|
248
|
-
containerRect,
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
const getElementOutlinePoints = (element, containerRect) => {
|
|
252
|
-
const elementRect = element.getBoundingClientRect();
|
|
253
|
-
if (elementRect.width === 0 && elementRect.height === 0) {
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
if (isSvgSvgElement(element)) {
|
|
257
|
-
return getSvgSvgElementOutlinePoints(element, containerRect);
|
|
258
|
-
}
|
|
259
|
-
const quads = (0, get_box_quads_ponyfill_1.getBoxQuadsPonyfill)(element, {
|
|
260
|
-
box: 'border',
|
|
261
|
-
});
|
|
262
|
-
const quad = quads === null || quads === void 0 ? void 0 : quads[0];
|
|
263
|
-
if (!quad) {
|
|
264
|
-
return rectToPoints(elementRect, containerRect);
|
|
265
|
-
}
|
|
266
|
-
return quadToPoints(quad, containerRect);
|
|
267
|
-
};
|
|
268
|
-
const getSelectedSequenceKeys = (selectedItems) => {
|
|
269
|
-
return new Set(selectedItems
|
|
270
|
-
.filter((item) => item.type === 'sequence')
|
|
271
|
-
.map((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo)));
|
|
272
|
-
};
|
|
273
|
-
exports.getSelectedSequenceKeys = getSelectedSequenceKeys;
|
|
274
|
-
const getSequenceKeysContainingSelection = (selectedItems) => {
|
|
275
|
-
return new Set(selectedItems.map((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo)));
|
|
276
|
-
};
|
|
277
|
-
const getOutlineSelectionInteraction = ({ shiftKey, metaKey, ctrlKey, }) => ({
|
|
278
|
-
shiftKey,
|
|
279
|
-
toggleKey: metaKey || ctrlKey,
|
|
280
|
-
});
|
|
281
|
-
exports.getOutlineSelectionInteraction = getOutlineSelectionInteraction;
|
|
282
|
-
const getSelectedEffectFieldsBySequenceKey = (selectedItems) => {
|
|
283
|
-
var _a, _b;
|
|
284
|
-
const selectedEffects = new Map();
|
|
285
|
-
for (const item of selectedItems) {
|
|
286
|
-
if (item.type !== 'sequence-effect' &&
|
|
287
|
-
item.type !== 'sequence-effect-prop') {
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
const sequenceKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo);
|
|
291
|
-
const effectsForSequence = (_a = selectedEffects.get(sequenceKey)) !== null && _a !== void 0 ? _a : new Map();
|
|
292
|
-
const selectedFields = (_b = effectsForSequence.get(item.i)) !== null && _b !== void 0 ? _b : {
|
|
293
|
-
allFields: false,
|
|
294
|
-
fieldKeys: new Set(),
|
|
295
|
-
};
|
|
296
|
-
if (item.type === 'sequence-effect') {
|
|
297
|
-
selectedFields.allFields = true;
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
selectedFields.fieldKeys.add(item.key);
|
|
301
|
-
}
|
|
302
|
-
effectsForSequence.set(item.i, selectedFields);
|
|
303
|
-
selectedEffects.set(sequenceKey, effectsForSequence);
|
|
304
|
-
}
|
|
305
|
-
return selectedEffects;
|
|
306
|
-
};
|
|
307
|
-
exports.getSelectedEffectFieldsBySequenceKey = getSelectedEffectFieldsBySequenceKey;
|
|
308
|
-
const getSelectedTransformOriginInfo = (selectedItems) => {
|
|
309
|
-
if (selectedItems.length !== 1) {
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
const [selectedItem] = selectedItems;
|
|
313
|
-
if (selectedItem.type === 'sequence-prop' &&
|
|
314
|
-
selectedItem.key === transformOriginFieldKey) {
|
|
315
|
-
return {
|
|
316
|
-
sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
|
|
317
|
-
displayFrame: null,
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
if (selectedItem.type !== 'keyframe') {
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
const field = (0, parse_keyframe_field_from_node_path_1.parseKeyframeFieldFromNodePath)(selectedItem.nodePathInfo.auxiliaryKeys);
|
|
324
|
-
if ((field === null || field === void 0 ? void 0 : field.type) !== 'sequence' ||
|
|
325
|
-
field.fieldKey !== transformOriginFieldKey) {
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
return {
|
|
329
|
-
sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
|
|
330
|
-
displayFrame: selectedItem.frame,
|
|
331
|
-
};
|
|
332
|
-
};
|
|
333
|
-
const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths, }) => {
|
|
334
|
-
return (0, calculate_timeline_1.calculateTimeline)({
|
|
335
|
-
sequences: [...sequences],
|
|
336
|
-
overrideIdsToNodePaths,
|
|
337
|
-
})
|
|
338
|
-
.filter((track) => {
|
|
339
|
-
if (track.nodePathInfo === null) {
|
|
340
|
-
return false;
|
|
341
|
-
}
|
|
342
|
-
return (track.sequence.showInTimeline &&
|
|
343
|
-
track.nodePathInfo.auxiliaryKeys.length === 0);
|
|
344
|
-
})
|
|
345
|
-
.filter((track) => track.sequence.refForOutline !== null)
|
|
346
|
-
.sort((a, b) => a.depth - b.depth)
|
|
347
|
-
.map((track) => {
|
|
348
|
-
if (track.nodePathInfo === null) {
|
|
349
|
-
throw new Error('Expected selected outline to have a node path');
|
|
350
|
-
}
|
|
351
|
-
return {
|
|
352
|
-
depth: track.depth,
|
|
353
|
-
keyframeDisplayOffset: track.keyframeDisplayOffset,
|
|
354
|
-
key: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(track.nodePathInfo),
|
|
355
|
-
nodePathInfo: track.nodePathInfo,
|
|
356
|
-
sequence: track.sequence,
|
|
357
|
-
};
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
exports.getSequencesWithSelectableOutlines = getSequencesWithSelectableOutlines;
|
|
361
|
-
const measureOutlines = (container, targets) => {
|
|
362
|
-
const containerRect = container.getBoundingClientRect();
|
|
363
|
-
const outlines = [];
|
|
364
|
-
for (const target of targets) {
|
|
365
|
-
const element = target.ref.current;
|
|
366
|
-
if (element === null) {
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
const points = getElementOutlinePoints(element, containerRect);
|
|
370
|
-
if (points === null) {
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
outlines.push({
|
|
374
|
-
key: target.key,
|
|
375
|
-
dimensions: element instanceof HTMLElement
|
|
376
|
-
? {
|
|
377
|
-
width: element.offsetWidth,
|
|
378
|
-
height: element.offsetHeight,
|
|
379
|
-
}
|
|
380
|
-
: element instanceof SVGSVGElement
|
|
381
|
-
? {
|
|
382
|
-
width: element.width.baseVal.value,
|
|
383
|
-
height: element.height.baseVal.value,
|
|
384
|
-
}
|
|
385
|
-
: null,
|
|
386
|
-
points,
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
return outlines;
|
|
390
|
-
};
|
|
391
|
-
const outlinesAreEqual = (a, b) => {
|
|
392
|
-
var _a, _b, _c, _d;
|
|
393
|
-
if (a.length !== b.length) {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
for (let i = 0; i < a.length; i++) {
|
|
397
|
-
if (a[i].key !== b[i].key) {
|
|
398
|
-
return false;
|
|
399
|
-
}
|
|
400
|
-
if (((_a = a[i].dimensions) === null || _a === void 0 ? void 0 : _a.width) !== ((_b = b[i].dimensions) === null || _b === void 0 ? void 0 : _b.width) ||
|
|
401
|
-
((_c = a[i].dimensions) === null || _c === void 0 ? void 0 : _c.height) !== ((_d = b[i].dimensions) === null || _d === void 0 ? void 0 : _d.height)) {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
for (let j = 0; j < a[i].points.length; j++) {
|
|
405
|
-
if (Math.abs(a[i].points[j].x - b[i].points[j].x) > 0.01 ||
|
|
406
|
-
Math.abs(a[i].points[j].y - b[i].points[j].y) > 0.01) {
|
|
407
|
-
return false;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return true;
|
|
412
|
-
};
|
|
413
|
-
const getSelectedOutlineDragStates = ({ dragTargets, getDragOverrides, timelinePosition, }) => {
|
|
414
|
-
return dragTargets.map((target) => {
|
|
415
|
-
var _a;
|
|
416
|
-
const dragOverrideValue = ((_a = getDragOverrides(target.nodePath)) !== null && _a !== void 0 ? _a : {})[translateFieldKey];
|
|
417
|
-
const sourceFrame = timelinePosition - target.keyframeDisplayOffset;
|
|
418
|
-
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
419
|
-
propStatus: target.propStatus,
|
|
420
|
-
dragOverrideValue,
|
|
421
|
-
defaultValue: target.fieldDefault,
|
|
422
|
-
frame: sourceFrame,
|
|
423
|
-
shouldResortToDefaultValueIfUndefined: true,
|
|
424
|
-
});
|
|
425
|
-
const [startX, startY] = (0, timeline_translate_utils_1.parseTranslate)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px'));
|
|
426
|
-
return {
|
|
427
|
-
defaultValue: target.fieldDefault !== undefined
|
|
428
|
-
? JSON.stringify(target.fieldDefault)
|
|
429
|
-
: null,
|
|
430
|
-
key: remotion_1.Internals.makeSequencePropsSubscriptionKey(target.nodePath),
|
|
431
|
-
sourceFrame,
|
|
432
|
-
startX,
|
|
433
|
-
startY,
|
|
434
|
-
target,
|
|
435
|
-
};
|
|
436
|
-
});
|
|
437
|
-
};
|
|
438
|
-
const getSelectedOutlineDragValues = ({ dragStates, deltaX, deltaY, }) => {
|
|
439
|
-
return new Map(dragStates.map((dragState) => [
|
|
440
|
-
dragState.key,
|
|
441
|
-
(0, timeline_translate_utils_1.serializeTranslate)(dragState.startX + deltaX, dragState.startY + deltaY),
|
|
442
|
-
]));
|
|
443
|
-
};
|
|
444
|
-
exports.getSelectedOutlineDragValues = getSelectedOutlineDragValues;
|
|
445
|
-
const applySelectedOutlineDragAxisLock = ({ deltaX, deltaY, axisLocked, }) => {
|
|
446
|
-
if (!axisLocked) {
|
|
447
|
-
return { deltaX, deltaY };
|
|
448
|
-
}
|
|
449
|
-
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
450
|
-
return { deltaX, deltaY: 0 };
|
|
451
|
-
}
|
|
452
|
-
return { deltaX: 0, deltaY };
|
|
453
|
-
};
|
|
454
|
-
exports.applySelectedOutlineDragAxisLock = applySelectedOutlineDragAxisLock;
|
|
455
|
-
const isSelectedOutlineDragPastThreshold = ({ deltaX, deltaY, }) => {
|
|
456
|
-
return Math.hypot(deltaX, deltaY) >= exports.selectedOutlineDragThresholdPx;
|
|
457
|
-
};
|
|
458
|
-
exports.isSelectedOutlineDragPastThreshold = isSelectedOutlineDragPastThreshold;
|
|
459
|
-
const getSelectedOutlineDragChanges = ({ dragStates, lastValues, }) => {
|
|
460
|
-
const changes = [];
|
|
461
|
-
for (const dragState of dragStates) {
|
|
462
|
-
const value = lastValues.get(dragState.key);
|
|
463
|
-
if (value === undefined) {
|
|
464
|
-
continue;
|
|
465
|
-
}
|
|
466
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
467
|
-
const startValue = (0, timeline_translate_utils_1.serializeTranslate)(dragState.startX, dragState.startY);
|
|
468
|
-
if (value === startValue) {
|
|
469
|
-
continue;
|
|
470
|
-
}
|
|
471
|
-
changes.push({
|
|
472
|
-
type: 'keyframed',
|
|
473
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
474
|
-
nodePath: dragState.target.nodePath,
|
|
475
|
-
fieldKey: translateFieldKey,
|
|
476
|
-
sourceFrame: dragState.sourceFrame,
|
|
477
|
-
value,
|
|
478
|
-
schema: dragState.target.schema,
|
|
479
|
-
clientId: dragState.target.clientId,
|
|
480
|
-
});
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
const stringifiedValue = JSON.stringify(value);
|
|
484
|
-
const shouldSave = value !== dragState.target.propStatus.codeValue &&
|
|
485
|
-
!(dragState.defaultValue === stringifiedValue &&
|
|
486
|
-
dragState.target.propStatus.codeValue === undefined);
|
|
487
|
-
if (!shouldSave) {
|
|
488
|
-
continue;
|
|
489
|
-
}
|
|
490
|
-
changes.push({
|
|
491
|
-
type: 'static',
|
|
492
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
493
|
-
nodePath: dragState.target.nodePath,
|
|
494
|
-
fieldKey: translateFieldKey,
|
|
495
|
-
value,
|
|
496
|
-
defaultValue: dragState.defaultValue,
|
|
497
|
-
schema: dragState.target.schema,
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
return changes;
|
|
501
|
-
};
|
|
502
|
-
exports.getSelectedOutlineDragChanges = getSelectedOutlineDragChanges;
|
|
503
|
-
const getSelectedOutlineKeyboardNudgeDelta = ({ direction, shiftKey, }) => {
|
|
504
|
-
const increment = shiftKey ? 10 : 1;
|
|
505
|
-
return direction === 'left' || direction === 'up' ? -increment : increment;
|
|
506
|
-
};
|
|
507
|
-
exports.getSelectedOutlineKeyboardNudgeDelta = getSelectedOutlineKeyboardNudgeDelta;
|
|
508
|
-
const getSelectedOutlineKeyboardNudgeDeltas = ({ deltaX, deltaY, direction, shiftKey, }) => {
|
|
509
|
-
const delta = (0, exports.getSelectedOutlineKeyboardNudgeDelta)({
|
|
510
|
-
direction,
|
|
511
|
-
shiftKey,
|
|
512
|
-
});
|
|
513
|
-
if (direction === 'left' || direction === 'right') {
|
|
514
|
-
return { deltaX: deltaX + delta, deltaY };
|
|
515
|
-
}
|
|
516
|
-
return { deltaX, deltaY: deltaY + delta };
|
|
517
|
-
};
|
|
518
|
-
exports.getSelectedOutlineKeyboardNudgeDeltas = getSelectedOutlineKeyboardNudgeDeltas;
|
|
519
|
-
const getSelectedOutlineScaleEdgeInfo = (points, edge) => {
|
|
520
|
-
const [tl, tr, br, bl] = points;
|
|
521
|
-
const edgePoints = {
|
|
522
|
-
top: { start: tl, end: tr, oppositeStart: bl, oppositeEnd: br },
|
|
523
|
-
right: { start: tr, end: br, oppositeStart: tl, oppositeEnd: bl },
|
|
524
|
-
bottom: { start: bl, end: br, oppositeStart: tl, oppositeEnd: tr },
|
|
525
|
-
left: { start: tl, end: bl, oppositeStart: tr, oppositeEnd: br },
|
|
526
|
-
}[edge];
|
|
527
|
-
const edgeMidpoint = midpoint(edgePoints.start, edgePoints.end);
|
|
528
|
-
const oppositeMidpoint = midpoint(edgePoints.oppositeStart, edgePoints.oppositeEnd);
|
|
529
|
-
const outward = vectorBetween(oppositeMidpoint, edgeMidpoint);
|
|
530
|
-
const length = vectorLength(outward);
|
|
531
|
-
if (length < 0.001) {
|
|
532
|
-
return null;
|
|
533
|
-
}
|
|
534
|
-
return {
|
|
535
|
-
axis: edge === 'left' || edge === 'right' ? 'x' : 'y',
|
|
536
|
-
cursor: edge === 'left' || edge === 'right' ? 'ew-resize' : 'ns-resize',
|
|
537
|
-
end: edgePoints.end,
|
|
538
|
-
extent: length,
|
|
539
|
-
normal: { x: outward.x / length, y: outward.y / length },
|
|
540
|
-
start: edgePoints.start,
|
|
541
|
-
};
|
|
542
|
-
};
|
|
543
|
-
exports.getSelectedOutlineScaleEdgeInfo = getSelectedOutlineScaleEdgeInfo;
|
|
544
|
-
const getSelectedOutlineScaleDragStates = ({ dragTargets, getDragOverrides, timelinePosition, }) => {
|
|
545
|
-
return dragTargets.map((target) => {
|
|
546
|
-
var _a;
|
|
547
|
-
const dragOverrideValue = ((_a = getDragOverrides(target.nodePath)) !== null && _a !== void 0 ? _a : {})[scaleFieldKey];
|
|
548
|
-
const sourceFrame = timelinePosition - target.keyframeDisplayOffset;
|
|
549
|
-
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
550
|
-
propStatus: target.propStatus,
|
|
551
|
-
dragOverrideValue,
|
|
552
|
-
defaultValue: target.fieldDefault,
|
|
553
|
-
frame: sourceFrame,
|
|
554
|
-
shouldResortToDefaultValueIfUndefined: true,
|
|
555
|
-
});
|
|
556
|
-
const [startX, startY, startZ] = no_react_1.NoReactInternals.parseScaleValue(effectiveValue);
|
|
557
|
-
return {
|
|
558
|
-
defaultValue: target.fieldDefault !== undefined
|
|
559
|
-
? JSON.stringify(target.fieldDefault)
|
|
560
|
-
: null,
|
|
561
|
-
key: remotion_1.Internals.makeSequencePropsSubscriptionKey(target.nodePath),
|
|
562
|
-
sourceFrame,
|
|
563
|
-
startX,
|
|
564
|
-
startY,
|
|
565
|
-
startZ,
|
|
566
|
-
target,
|
|
567
|
-
};
|
|
568
|
-
});
|
|
569
|
-
};
|
|
570
|
-
exports.getSelectedOutlineScaleDragStates = getSelectedOutlineScaleDragStates;
|
|
571
|
-
const getSelectedOutlineScaleDragValues = ({ axis, dragStates, scaleFactor, }) => {
|
|
572
|
-
return new Map(dragStates.map((dragState) => {
|
|
573
|
-
var _a, _b;
|
|
574
|
-
const min = (_a = dragState.target.fieldSchema.min) !== null && _a !== void 0 ? _a : -Infinity;
|
|
575
|
-
const max = (_b = dragState.target.fieldSchema.max) !== null && _b !== void 0 ? _b : Infinity;
|
|
576
|
-
const decimalPlaces = (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
577
|
-
defaultDecimalPlaces: 3,
|
|
578
|
-
step: dragState.target.fieldSchema.step,
|
|
579
|
-
});
|
|
580
|
-
const baseX = dragState.startX;
|
|
581
|
-
const baseY = dragState.startY;
|
|
582
|
-
const newValue = (axis === 'x' ? baseX : baseY) * scaleFactor;
|
|
583
|
-
const [rawX, rawY] = dragState.target.linked
|
|
584
|
-
? (0, TimelineScaleField_1.getLinkedScale)({
|
|
585
|
-
axis,
|
|
586
|
-
newValue,
|
|
587
|
-
baseX,
|
|
588
|
-
baseY,
|
|
589
|
-
min,
|
|
590
|
-
max,
|
|
591
|
-
})
|
|
592
|
-
: axis === 'x'
|
|
593
|
-
? [(0, selected_outline_geometry_1.clamp)(newValue, min, max), baseY]
|
|
594
|
-
: [baseX, (0, selected_outline_geometry_1.clamp)(newValue, min, max)];
|
|
595
|
-
const x = (0, timeline_field_utils_1.roundToDecimalPlaces)(rawX, decimalPlaces);
|
|
596
|
-
const y = (0, timeline_field_utils_1.roundToDecimalPlaces)(rawY, decimalPlaces);
|
|
597
|
-
return [
|
|
598
|
-
dragState.key,
|
|
599
|
-
no_react_1.NoReactInternals.serializeScaleValue([x, y, dragState.startZ]),
|
|
600
|
-
];
|
|
601
|
-
}));
|
|
602
|
-
};
|
|
603
|
-
exports.getSelectedOutlineScaleDragValues = getSelectedOutlineScaleDragValues;
|
|
604
|
-
const getSelectedOutlineScaleDragChanges = ({ dragStates, lastValues, }) => {
|
|
605
|
-
const changes = [];
|
|
606
|
-
for (const dragState of dragStates) {
|
|
607
|
-
const value = lastValues.get(dragState.key);
|
|
608
|
-
if (value === undefined) {
|
|
609
|
-
continue;
|
|
610
|
-
}
|
|
611
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
612
|
-
const startValue = no_react_1.NoReactInternals.serializeScaleValue([
|
|
613
|
-
dragState.startX,
|
|
614
|
-
dragState.startY,
|
|
615
|
-
dragState.startZ,
|
|
616
|
-
]);
|
|
617
|
-
if (value === startValue) {
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
changes.push({
|
|
621
|
-
type: 'keyframed',
|
|
622
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
623
|
-
nodePath: dragState.target.nodePath,
|
|
624
|
-
fieldKey: scaleFieldKey,
|
|
625
|
-
sourceFrame: dragState.sourceFrame,
|
|
626
|
-
value,
|
|
627
|
-
schema: dragState.target.schema,
|
|
628
|
-
clientId: dragState.target.clientId,
|
|
629
|
-
});
|
|
630
|
-
continue;
|
|
631
|
-
}
|
|
632
|
-
const stringifiedValue = JSON.stringify(value);
|
|
633
|
-
const shouldSave = stringifiedValue !==
|
|
634
|
-
JSON.stringify(dragState.target.propStatus.codeValue) &&
|
|
635
|
-
!(dragState.defaultValue === stringifiedValue &&
|
|
636
|
-
dragState.target.propStatus.codeValue === undefined);
|
|
637
|
-
if (!shouldSave) {
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
changes.push({
|
|
641
|
-
type: 'static',
|
|
642
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
643
|
-
nodePath: dragState.target.nodePath,
|
|
644
|
-
fieldKey: scaleFieldKey,
|
|
645
|
-
value,
|
|
646
|
-
defaultValue: dragState.defaultValue,
|
|
647
|
-
schema: dragState.target.schema,
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
return changes;
|
|
651
|
-
};
|
|
652
|
-
exports.getSelectedOutlineScaleDragChanges = getSelectedOutlineScaleDragChanges;
|
|
653
|
-
const getSelectedOutlineRotationDragStates = ({ dragTargets, getDragOverrides, timelinePosition, }) => {
|
|
654
|
-
return dragTargets.map((target) => {
|
|
655
|
-
var _a;
|
|
656
|
-
const dragOverrideValue = ((_a = getDragOverrides(target.nodePath)) !== null && _a !== void 0 ? _a : {})[rotateFieldKey];
|
|
657
|
-
const sourceFrame = timelinePosition - target.keyframeDisplayOffset;
|
|
658
|
-
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
659
|
-
propStatus: target.propStatus,
|
|
660
|
-
dragOverrideValue,
|
|
661
|
-
defaultValue: target.fieldDefault,
|
|
662
|
-
frame: sourceFrame,
|
|
663
|
-
shouldResortToDefaultValueIfUndefined: true,
|
|
664
|
-
});
|
|
665
|
-
return {
|
|
666
|
-
defaultValue: target.fieldDefault !== undefined
|
|
667
|
-
? JSON.stringify(target.fieldDefault)
|
|
668
|
-
: null,
|
|
669
|
-
key: remotion_1.Internals.makeSequencePropsSubscriptionKey(target.nodePath),
|
|
670
|
-
sourceFrame,
|
|
671
|
-
startDegrees: (0, timeline_rotation_utils_1.parseCssRotationToDegrees)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg')),
|
|
672
|
-
target,
|
|
673
|
-
};
|
|
674
|
-
});
|
|
675
|
-
};
|
|
676
|
-
exports.getSelectedOutlineRotationDragStates = getSelectedOutlineRotationDragStates;
|
|
677
|
-
const getSelectedOutlineRotationDragValues = ({ dragStates, rotationDeltaDegrees, }) => {
|
|
678
|
-
return new Map(dragStates.map((dragState) => {
|
|
679
|
-
const decimalPlaces = (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
680
|
-
defaultDecimalPlaces: 1,
|
|
681
|
-
step: dragState.target.fieldSchema.step,
|
|
682
|
-
});
|
|
683
|
-
return [
|
|
684
|
-
dragState.key,
|
|
685
|
-
(0, timeline_rotation_utils_1.serializeCssRotation)(dragState.startDegrees + rotationDeltaDegrees, decimalPlaces),
|
|
686
|
-
];
|
|
687
|
-
}));
|
|
688
|
-
};
|
|
689
|
-
exports.getSelectedOutlineRotationDragValues = getSelectedOutlineRotationDragValues;
|
|
690
|
-
const getSelectedOutlineRotationDragChanges = ({ dragStates, lastValues, }) => {
|
|
691
|
-
const changes = [];
|
|
692
|
-
for (const dragState of dragStates) {
|
|
693
|
-
const value = lastValues.get(dragState.key);
|
|
694
|
-
if (value === undefined) {
|
|
695
|
-
continue;
|
|
696
|
-
}
|
|
697
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
698
|
-
const decimalPlaces = (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
699
|
-
defaultDecimalPlaces: 1,
|
|
700
|
-
step: dragState.target.fieldSchema.step,
|
|
701
|
-
});
|
|
702
|
-
const startValue = (0, timeline_rotation_utils_1.serializeCssRotation)(dragState.startDegrees, decimalPlaces);
|
|
703
|
-
if (value === startValue) {
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
changes.push({
|
|
707
|
-
type: 'keyframed',
|
|
708
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
709
|
-
nodePath: dragState.target.nodePath,
|
|
710
|
-
fieldKey: rotateFieldKey,
|
|
711
|
-
sourceFrame: dragState.sourceFrame,
|
|
712
|
-
value,
|
|
713
|
-
schema: dragState.target.schema,
|
|
714
|
-
clientId: dragState.target.clientId,
|
|
715
|
-
});
|
|
716
|
-
continue;
|
|
717
|
-
}
|
|
718
|
-
const stringifiedValue = JSON.stringify(value);
|
|
719
|
-
const shouldSave = value !== dragState.target.propStatus.codeValue &&
|
|
720
|
-
!(dragState.defaultValue === stringifiedValue &&
|
|
721
|
-
dragState.target.propStatus.codeValue === undefined);
|
|
722
|
-
if (!shouldSave) {
|
|
723
|
-
continue;
|
|
724
|
-
}
|
|
725
|
-
changes.push({
|
|
726
|
-
type: 'static',
|
|
727
|
-
fileName: dragState.target.nodePath.absolutePath,
|
|
728
|
-
nodePath: dragState.target.nodePath,
|
|
729
|
-
fieldKey: rotateFieldKey,
|
|
730
|
-
value,
|
|
731
|
-
defaultValue: dragState.defaultValue,
|
|
732
|
-
schema: dragState.target.schema,
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
return changes;
|
|
736
|
-
};
|
|
737
|
-
exports.getSelectedOutlineRotationDragChanges = getSelectedOutlineRotationDragChanges;
|
|
738
|
-
const clearSelectedOutlineDragOverrides = ({ clearDragOverrides, dragStates, }) => {
|
|
739
|
-
for (const dragState of dragStates) {
|
|
740
|
-
clearDragOverrides(dragState.target.nodePath);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
const getSelectedOutlineKeyboardNudgeDirection = (key) => {
|
|
744
|
-
if (key === 'ArrowLeft') {
|
|
745
|
-
return 'left';
|
|
746
|
-
}
|
|
747
|
-
if (key === 'ArrowRight') {
|
|
748
|
-
return 'right';
|
|
749
|
-
}
|
|
750
|
-
if (key === 'ArrowUp') {
|
|
751
|
-
return 'up';
|
|
752
|
-
}
|
|
753
|
-
if (key === 'ArrowDown') {
|
|
754
|
-
return 'down';
|
|
755
|
-
}
|
|
756
|
-
return null;
|
|
757
|
-
};
|
|
758
|
-
const clearSelectedOutlineScaleDragOverrides = ({ clearDragOverrides, dragStates, }) => {
|
|
759
|
-
for (const dragState of dragStates) {
|
|
760
|
-
clearDragOverrides(dragState.target.nodePath);
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
const clearSelectedOutlineRotationDragOverrides = ({ clearDragOverrides, dragStates, }) => {
|
|
764
|
-
for (const dragState of dragStates) {
|
|
765
|
-
clearDragOverrides(dragState.target.nodePath);
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
const parseCssRotationToRadians = (value) => {
|
|
769
|
-
const match = value
|
|
770
|
-
.trim()
|
|
771
|
-
.match(/^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|turn|grad)$/);
|
|
772
|
-
if (!match) {
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
const number = Number(match[1]);
|
|
776
|
-
if (!Number.isFinite(number)) {
|
|
777
|
-
return null;
|
|
778
|
-
}
|
|
779
|
-
if (match[2] === 'rad') {
|
|
780
|
-
return number;
|
|
781
|
-
}
|
|
782
|
-
if (match[2] === 'turn') {
|
|
783
|
-
return number * Math.PI * 2;
|
|
784
|
-
}
|
|
785
|
-
if (match[2] === 'grad') {
|
|
786
|
-
return (number / 400) * Math.PI * 2;
|
|
787
|
-
}
|
|
788
|
-
return (number / 180) * Math.PI;
|
|
789
|
-
};
|
|
790
|
-
const compensateTranslateForTransformOrigin = ({ startTranslate, deltaOrigin, rotate, scale, }) => {
|
|
791
|
-
const cos = Math.cos(rotate);
|
|
792
|
-
const sin = Math.sin(rotate);
|
|
793
|
-
const matrixA = cos * scale[0];
|
|
794
|
-
const matrixB = sin * scale[0];
|
|
795
|
-
const matrixC = -sin * scale[1];
|
|
796
|
-
const matrixD = cos * scale[1];
|
|
797
|
-
const transformedDeltaX = matrixA * deltaOrigin[0] + matrixC * deltaOrigin[1];
|
|
798
|
-
const transformedDeltaY = matrixB * deltaOrigin[0] + matrixD * deltaOrigin[1];
|
|
799
|
-
const compensationX = deltaOrigin[0] - transformedDeltaX;
|
|
800
|
-
const compensationY = deltaOrigin[1] - transformedDeltaY;
|
|
801
|
-
return [startTranslate[0] - compensationX, startTranslate[1] - compensationY];
|
|
802
|
-
};
|
|
803
|
-
exports.compensateTranslateForTransformOrigin = compensateTranslateForTransformOrigin;
|
|
804
|
-
const uvsEqual = (left, right) => Math.abs(left[0] - right[0]) < 0.000001 &&
|
|
805
|
-
Math.abs(left[1] - right[1]) < 0.000001;
|
|
806
|
-
const SelectedOutlineTransformOriginHandle = ({ outline, onDraggingChange, target }) => {
|
|
807
|
-
var _a;
|
|
808
|
-
const { setDragOverrides, clearDragOverrides, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
809
|
-
const transformOriginDrag = (_a = target === null || target === void 0 ? void 0 : target.transformOriginDrag) !== null && _a !== void 0 ? _a : null;
|
|
810
|
-
const parsed = (0, react_1.useMemo)(() => transformOriginDrag === null
|
|
811
|
-
? null
|
|
812
|
-
: (0, transform_origin_utils_1.parseTransformOrigin)(transformOriginDrag.originValue), [transformOriginDrag]);
|
|
813
|
-
const uv = (0, react_1.useMemo)(() => {
|
|
814
|
-
if (parsed === null || outline.dimensions === null) {
|
|
815
|
-
return null;
|
|
816
|
-
}
|
|
817
|
-
return (0, transform_origin_utils_1.parsedTransformOriginToUv)({
|
|
818
|
-
parsed,
|
|
819
|
-
width: outline.dimensions.width,
|
|
820
|
-
height: outline.dimensions.height,
|
|
821
|
-
});
|
|
822
|
-
}, [outline.dimensions, parsed]);
|
|
823
|
-
const position = (0, react_1.useMemo)(() => (uv === null ? null : (0, selected_outline_uv_1.getUvHandlePosition)(outline.points, uv)), [outline.points, uv]);
|
|
824
|
-
const onPointerDown = react_1.default.useCallback((event) => {
|
|
825
|
-
if (event.button !== 0 ||
|
|
826
|
-
transformOriginDrag === null ||
|
|
827
|
-
parsed === null ||
|
|
828
|
-
uv === null ||
|
|
829
|
-
outline.dimensions === null) {
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
event.preventDefault();
|
|
833
|
-
event.stopPropagation();
|
|
834
|
-
const svg = event.currentTarget.ownerSVGElement;
|
|
835
|
-
if (svg === null) {
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
const rotation = parseCssRotationToRadians(transformOriginDrag.rotateValue);
|
|
839
|
-
if (rotation === null) {
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
const { dimensions } = outline;
|
|
843
|
-
if (dimensions === null) {
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
const [scaleX, scaleY] = no_react_1.NoReactInternals.parseScaleValue(transformOriginDrag.scaleValue);
|
|
847
|
-
const startTranslate = (0, timeline_translate_utils_1.parseTranslate)(transformOriginDrag.translateValue);
|
|
848
|
-
const svgRect = svg.getBoundingClientRect();
|
|
849
|
-
const defaultOrigin = transformOriginDrag.originDefault !== undefined
|
|
850
|
-
? JSON.stringify(transformOriginDrag.originDefault)
|
|
851
|
-
: null;
|
|
852
|
-
const defaultTranslate = transformOriginDrag.translateDefault !== undefined
|
|
853
|
-
? JSON.stringify(transformOriginDrag.translateDefault)
|
|
854
|
-
: null;
|
|
855
|
-
let last = null;
|
|
856
|
-
onDraggingChange(true);
|
|
857
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)('crosshair');
|
|
858
|
-
const updateFromPointerEvent = (pointerEvent) => {
|
|
859
|
-
const point = {
|
|
860
|
-
x: pointerEvent.clientX - svgRect.left,
|
|
861
|
-
y: pointerEvent.clientY - svgRect.top,
|
|
862
|
-
};
|
|
863
|
-
const nextUv = (0, selected_outline_uv_1.getUvCoordinateForPoint)(outline.points, point);
|
|
864
|
-
const deltaOrigin = [
|
|
865
|
-
(nextUv[0] - uv[0]) * dimensions.width,
|
|
866
|
-
(nextUv[1] - uv[1]) * dimensions.height,
|
|
867
|
-
];
|
|
868
|
-
const [nextTranslateX, nextTranslateY] = (0, exports.compensateTranslateForTransformOrigin)({
|
|
869
|
-
startTranslate,
|
|
870
|
-
deltaOrigin,
|
|
871
|
-
rotate: rotation,
|
|
872
|
-
scale: [scaleX, scaleY],
|
|
873
|
-
});
|
|
874
|
-
const origin = (0, transform_origin_utils_1.serializeTransformOrigin)({
|
|
875
|
-
uv: nextUv,
|
|
876
|
-
z: parsed.z,
|
|
877
|
-
});
|
|
878
|
-
const translate = (0, timeline_translate_utils_1.serializeTranslate)(nextTranslateX, nextTranslateY);
|
|
879
|
-
last = { uv: nextUv, origin, translate };
|
|
880
|
-
setDragOverrides(transformOriginDrag.nodePath, transformOriginFieldKey, transformOriginDrag.originPropStatus.status === 'keyframed'
|
|
881
|
-
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
882
|
-
status: transformOriginDrag.originPropStatus,
|
|
883
|
-
frame: transformOriginDrag.sourceFrame,
|
|
884
|
-
value: origin,
|
|
885
|
-
})
|
|
886
|
-
: remotion_1.Internals.makeStaticDragOverride(origin));
|
|
887
|
-
setDragOverrides(transformOriginDrag.nodePath, translateFieldKey, transformOriginDrag.translatePropStatus.status === 'keyframed'
|
|
888
|
-
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
889
|
-
status: transformOriginDrag.translatePropStatus,
|
|
890
|
-
frame: transformOriginDrag.sourceFrame,
|
|
891
|
-
value: translate,
|
|
892
|
-
})
|
|
893
|
-
: remotion_1.Internals.makeStaticDragOverride(translate));
|
|
894
|
-
};
|
|
895
|
-
updateFromPointerEvent(event);
|
|
896
|
-
const onPointerMove = (moveEvent) => {
|
|
897
|
-
moveEvent.preventDefault();
|
|
898
|
-
updateFromPointerEvent(moveEvent);
|
|
899
|
-
};
|
|
900
|
-
const onPointerUp = () => {
|
|
901
|
-
window.removeEventListener('pointermove', onPointerMove);
|
|
902
|
-
window.removeEventListener('pointerup', onPointerUp);
|
|
903
|
-
window.removeEventListener('pointercancel', onPointerUp);
|
|
904
|
-
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
905
|
-
onDraggingChange(false);
|
|
906
|
-
if (last === null || uvsEqual(last.uv, uv)) {
|
|
907
|
-
clearDragOverrides(transformOriginDrag.nodePath);
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
const originChanged = last.origin !== transformOriginDrag.originValue;
|
|
911
|
-
const translateChanged = last.translate !== transformOriginDrag.translateValue;
|
|
912
|
-
if (!originChanged && !translateChanged) {
|
|
913
|
-
clearDragOverrides(transformOriginDrag.nodePath);
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
const shouldSaveAsKeyframes = transformOriginDrag.originPropStatus.status === 'keyframed' ||
|
|
917
|
-
transformOriginDrag.translatePropStatus.status === 'keyframed';
|
|
918
|
-
const promise = shouldSaveAsKeyframes
|
|
919
|
-
? (0, call_add_keyframe_1.callAddKeyframes)({
|
|
920
|
-
sequenceKeyframes: [
|
|
921
|
-
originChanged
|
|
922
|
-
? {
|
|
923
|
-
fileName: transformOriginDrag.nodePath.absolutePath,
|
|
924
|
-
nodePath: transformOriginDrag.nodePath,
|
|
925
|
-
fieldKey: transformOriginFieldKey,
|
|
926
|
-
sourceFrame: transformOriginDrag.sourceFrame,
|
|
927
|
-
value: last.origin,
|
|
928
|
-
schema: transformOriginDrag.schema,
|
|
929
|
-
}
|
|
930
|
-
: null,
|
|
931
|
-
translateChanged
|
|
932
|
-
? {
|
|
933
|
-
fileName: transformOriginDrag.nodePath.absolutePath,
|
|
934
|
-
nodePath: transformOriginDrag.nodePath,
|
|
935
|
-
fieldKey: translateFieldKey,
|
|
936
|
-
sourceFrame: transformOriginDrag.sourceFrame,
|
|
937
|
-
value: last.translate,
|
|
938
|
-
schema: transformOriginDrag.schema,
|
|
939
|
-
}
|
|
940
|
-
: null,
|
|
941
|
-
].filter(no_react_1.NoReactInternals.truthy),
|
|
942
|
-
effectKeyframes: [],
|
|
943
|
-
setPropStatuses,
|
|
944
|
-
clientId: transformOriginDrag.clientId,
|
|
945
|
-
})
|
|
946
|
-
: (0, save_sequence_prop_1.saveSequenceProps)({
|
|
947
|
-
changes: [
|
|
948
|
-
originChanged
|
|
949
|
-
? {
|
|
950
|
-
fileName: transformOriginDrag.nodePath.absolutePath,
|
|
951
|
-
nodePath: transformOriginDrag.nodePath,
|
|
952
|
-
fieldKey: transformOriginFieldKey,
|
|
953
|
-
value: last.origin,
|
|
954
|
-
defaultValue: defaultOrigin,
|
|
955
|
-
schema: transformOriginDrag.schema,
|
|
956
|
-
}
|
|
957
|
-
: null,
|
|
958
|
-
translateChanged
|
|
959
|
-
? {
|
|
960
|
-
fileName: transformOriginDrag.nodePath.absolutePath,
|
|
961
|
-
nodePath: transformOriginDrag.nodePath,
|
|
962
|
-
fieldKey: translateFieldKey,
|
|
963
|
-
value: last.translate,
|
|
964
|
-
defaultValue: defaultTranslate,
|
|
965
|
-
schema: transformOriginDrag.schema,
|
|
966
|
-
}
|
|
967
|
-
: null,
|
|
968
|
-
].filter(no_react_1.NoReactInternals.truthy),
|
|
969
|
-
setPropStatuses,
|
|
970
|
-
clientId: transformOriginDrag.clientId,
|
|
971
|
-
undoLabel: 'Move transform origin',
|
|
972
|
-
redoLabel: 'Move transform origin back',
|
|
973
|
-
});
|
|
974
|
-
promise
|
|
975
|
-
.catch((err) => {
|
|
976
|
-
(0, NotificationCenter_1.showNotification)(`Could not save transform origin: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
977
|
-
})
|
|
978
|
-
.finally(() => {
|
|
979
|
-
clearDragOverrides(transformOriginDrag.nodePath);
|
|
980
|
-
});
|
|
981
|
-
};
|
|
982
|
-
window.addEventListener('pointermove', onPointerMove);
|
|
983
|
-
window.addEventListener('pointerup', onPointerUp);
|
|
984
|
-
window.addEventListener('pointercancel', onPointerUp);
|
|
985
|
-
}, [
|
|
986
|
-
clearDragOverrides,
|
|
987
|
-
onDraggingChange,
|
|
988
|
-
outline,
|
|
989
|
-
parsed,
|
|
990
|
-
setDragOverrides,
|
|
991
|
-
setPropStatuses,
|
|
992
|
-
transformOriginDrag,
|
|
993
|
-
uv,
|
|
994
|
-
]);
|
|
995
|
-
if (transformOriginDrag === null ||
|
|
996
|
-
parsed === null ||
|
|
997
|
-
uv === null ||
|
|
998
|
-
position === null) {
|
|
999
|
-
return null;
|
|
1000
|
-
}
|
|
1001
|
-
return (jsx_runtime_1.jsxs("g", { pointerEvents: "all", cursor: "crosshair", onPointerDown: onPointerDown, "aria-hidden": "true", children: [
|
|
1002
|
-
jsx_runtime_1.jsx("circle", { cx: position.x, cy: position.y, r: 4, stroke: colors_1.BLUE, fill: "none", strokeWidth: 2, vectorEffect: "non-scaling-stroke" }), jsx_runtime_1.jsx("line", { x1: position.x - 8, y1: position.y, x2: position.x + 8, y2: position.y, stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke" }), jsx_runtime_1.jsx("line", { x1: position.x, y1: position.y - 8, x2: position.x, y2: position.y + 8, stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke" })
|
|
1003
|
-
] }));
|
|
1004
|
-
};
|
|
1005
|
-
const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, hovered, onContextMenuOpen, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
|
|
1006
|
-
var _a, _b, _c, _d;
|
|
1007
|
-
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
1008
|
-
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
1009
|
-
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
1010
|
-
const timelinePositionRef = (0, react_1.useRef)(timelinePosition);
|
|
1011
|
-
timelinePositionRef.current = timelinePosition;
|
|
1012
|
-
const polygonRef = (0, react_1.useRef)(null);
|
|
1013
|
-
const points = (0, react_1.useMemo)(() => outline.points.map(pointToString).join(' '), [outline.points]);
|
|
1014
|
-
const drag = (_a = target === null || target === void 0 ? void 0 : target.drag) !== null && _a !== void 0 ? _a : null;
|
|
1015
|
-
const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
|
|
1016
|
-
const containsSelection = (_c = target === null || target === void 0 ? void 0 : target.containsSelection) !== null && _c !== void 0 ? _c : false;
|
|
1017
|
-
const effectDrop = (_d = target === null || target === void 0 ? void 0 : target.effectDrop) !== null && _d !== void 0 ? _d : null;
|
|
1018
|
-
const [effectDropHovered, setEffectDropHovered] = (0, react_1.useState)(false);
|
|
1019
|
-
const visible = containsSelection || hovered;
|
|
1020
|
-
const onPointerDown = react_1.default.useCallback((event) => {
|
|
1021
|
-
if (event.button !== 0 || target === undefined) {
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
event.preventDefault();
|
|
1025
|
-
event.stopPropagation();
|
|
1026
|
-
const interaction = (0, exports.getOutlineSelectionInteraction)(event);
|
|
1027
|
-
const shouldUpdateSelection = !selected || interaction.shiftKey || interaction.toggleKey;
|
|
1028
|
-
if (shouldUpdateSelection) {
|
|
1029
|
-
onSelect(target.selection, interaction);
|
|
1030
|
-
}
|
|
1031
|
-
if (drag === null || interaction.shiftKey || interaction.toggleKey) {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
const startPointerX = event.clientX;
|
|
1035
|
-
const startPointerY = event.clientY;
|
|
1036
|
-
const dragStates = getSelectedOutlineDragStates({
|
|
1037
|
-
dragTargets: selected ? allDragTargets : [drag],
|
|
1038
|
-
getDragOverrides,
|
|
1039
|
-
timelinePosition: timelinePositionRef.current,
|
|
1040
|
-
});
|
|
1041
|
-
let lastValues = new Map();
|
|
1042
|
-
let currentPointerX = startPointerX;
|
|
1043
|
-
let currentPointerY = startPointerY;
|
|
1044
|
-
let axisLocked = false;
|
|
1045
|
-
let dragStarted = false;
|
|
1046
|
-
const updateDragOverrides = () => {
|
|
1047
|
-
const screenDeltaX = currentPointerX - startPointerX;
|
|
1048
|
-
const screenDeltaY = currentPointerY - startPointerY;
|
|
1049
|
-
if (!dragStarted) {
|
|
1050
|
-
if (!(0, exports.isSelectedOutlineDragPastThreshold)({
|
|
1051
|
-
deltaX: screenDeltaX,
|
|
1052
|
-
deltaY: screenDeltaY,
|
|
1053
|
-
})) {
|
|
1054
|
-
return;
|
|
1055
|
-
}
|
|
1056
|
-
dragStarted = true;
|
|
1057
|
-
onDraggingChange(true);
|
|
1058
|
-
}
|
|
1059
|
-
const dragDelta = (0, exports.applySelectedOutlineDragAxisLock)({
|
|
1060
|
-
deltaX: screenDeltaX / scale,
|
|
1061
|
-
deltaY: screenDeltaY / scale,
|
|
1062
|
-
axisLocked,
|
|
1063
|
-
});
|
|
1064
|
-
lastValues = (0, exports.getSelectedOutlineDragValues)({
|
|
1065
|
-
dragStates,
|
|
1066
|
-
deltaX: dragDelta.deltaX,
|
|
1067
|
-
deltaY: dragDelta.deltaY,
|
|
1068
|
-
});
|
|
1069
|
-
for (const dragState of dragStates) {
|
|
1070
|
-
const value = lastValues.get(dragState.key);
|
|
1071
|
-
if (value === undefined) {
|
|
1072
|
-
throw new Error('Expected drag value to be available');
|
|
1073
|
-
}
|
|
1074
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
1075
|
-
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
1076
|
-
status: dragState.target.propStatus,
|
|
1077
|
-
frame: dragState.sourceFrame,
|
|
1078
|
-
value,
|
|
1079
|
-
}));
|
|
1080
|
-
}
|
|
1081
|
-
else {
|
|
1082
|
-
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
};
|
|
1086
|
-
const onPointerMove = (moveEvent) => {
|
|
1087
|
-
moveEvent.preventDefault();
|
|
1088
|
-
currentPointerX = moveEvent.clientX;
|
|
1089
|
-
currentPointerY = moveEvent.clientY;
|
|
1090
|
-
axisLocked = moveEvent.shiftKey;
|
|
1091
|
-
updateDragOverrides();
|
|
1092
|
-
};
|
|
1093
|
-
const onKeyChange = (keyEvent) => {
|
|
1094
|
-
if (keyEvent.key !== 'Shift') {
|
|
1095
|
-
return;
|
|
1096
|
-
}
|
|
1097
|
-
const nextAxisLocked = keyEvent.type === 'keydown';
|
|
1098
|
-
if (nextAxisLocked === axisLocked) {
|
|
1099
|
-
return;
|
|
1100
|
-
}
|
|
1101
|
-
axisLocked = nextAxisLocked;
|
|
1102
|
-
updateDragOverrides();
|
|
1103
|
-
};
|
|
1104
|
-
const onPointerUp = () => {
|
|
1105
|
-
window.removeEventListener('pointermove', onPointerMove);
|
|
1106
|
-
window.removeEventListener('pointerup', onPointerUp);
|
|
1107
|
-
window.removeEventListener('pointercancel', onPointerUp);
|
|
1108
|
-
window.removeEventListener('keydown', onKeyChange);
|
|
1109
|
-
window.removeEventListener('keyup', onKeyChange);
|
|
1110
|
-
if (dragStarted) {
|
|
1111
|
-
onDraggingChange(false);
|
|
1112
|
-
}
|
|
1113
|
-
const changes = (0, exports.getSelectedOutlineDragChanges)({
|
|
1114
|
-
dragStates,
|
|
1115
|
-
lastValues,
|
|
1116
|
-
});
|
|
1117
|
-
if (changes.length === 0) {
|
|
1118
|
-
clearSelectedOutlineDragOverrides({ clearDragOverrides, dragStates });
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
1122
|
-
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
1123
|
-
Promise.all([
|
|
1124
|
-
staticChanges.length > 0
|
|
1125
|
-
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
1126
|
-
changes: staticChanges,
|
|
1127
|
-
setPropStatuses,
|
|
1128
|
-
clientId: drag.clientId,
|
|
1129
|
-
undoLabel: changes.length > 1
|
|
1130
|
-
? 'Move selected sequences'
|
|
1131
|
-
: 'Move sequence',
|
|
1132
|
-
redoLabel: changes.length > 1
|
|
1133
|
-
? 'Move selected sequences back'
|
|
1134
|
-
: 'Move sequence back',
|
|
1135
|
-
})
|
|
1136
|
-
: Promise.resolve(),
|
|
1137
|
-
...keyframedChanges.map((change) => (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
1138
|
-
fileName: change.fileName,
|
|
1139
|
-
nodePath: change.nodePath,
|
|
1140
|
-
fieldKey: change.fieldKey,
|
|
1141
|
-
sourceFrame: change.sourceFrame,
|
|
1142
|
-
value: change.value,
|
|
1143
|
-
schema: change.schema,
|
|
1144
|
-
setPropStatuses,
|
|
1145
|
-
clientId: change.clientId,
|
|
1146
|
-
})),
|
|
1147
|
-
])
|
|
1148
|
-
.catch((err) => {
|
|
1149
|
-
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
1150
|
-
})
|
|
1151
|
-
.finally(() => {
|
|
1152
|
-
clearSelectedOutlineDragOverrides({ clearDragOverrides, dragStates });
|
|
1153
|
-
});
|
|
1154
|
-
};
|
|
1155
|
-
window.addEventListener('pointermove', onPointerMove);
|
|
1156
|
-
window.addEventListener('pointerup', onPointerUp);
|
|
1157
|
-
window.addEventListener('pointercancel', onPointerUp);
|
|
1158
|
-
window.addEventListener('keydown', onKeyChange);
|
|
1159
|
-
window.addEventListener('keyup', onKeyChange);
|
|
1160
|
-
}, [
|
|
1161
|
-
allDragTargets,
|
|
1162
|
-
clearDragOverrides,
|
|
1163
|
-
drag,
|
|
1164
|
-
getDragOverrides,
|
|
1165
|
-
onDraggingChange,
|
|
1166
|
-
onSelect,
|
|
1167
|
-
scale,
|
|
1168
|
-
selected,
|
|
1169
|
-
setPropStatuses,
|
|
1170
|
-
setDragOverrides,
|
|
1171
|
-
target,
|
|
1172
|
-
]);
|
|
1173
|
-
const onEffectDragOver = react_1.default.useCallback((event) => {
|
|
1174
|
-
if (effectDrop === null || !(0, effect_drag_and_drop_1.hasEffectDragType)(event.dataTransfer)) {
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
event.preventDefault();
|
|
1178
|
-
event.stopPropagation();
|
|
1179
|
-
event.dataTransfer.dropEffect = 'copy';
|
|
1180
|
-
setEffectDropHovered(true);
|
|
1181
|
-
}, [effectDrop]);
|
|
1182
|
-
const onEffectDragLeave = react_1.default.useCallback((event) => {
|
|
1183
|
-
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
setEffectDropHovered(false);
|
|
1187
|
-
}, []);
|
|
1188
|
-
const onEffectDrop = react_1.default.useCallback(async (event) => {
|
|
1189
|
-
if (effectDrop === null || !(0, effect_drag_and_drop_1.hasEffectDragType)(event.dataTransfer)) {
|
|
1190
|
-
return;
|
|
1191
|
-
}
|
|
1192
|
-
const dragData = (0, effect_drag_and_drop_1.getEffectDragData)(event.dataTransfer);
|
|
1193
|
-
if (!dragData) {
|
|
1194
|
-
if ((0, effect_drag_and_drop_1.hasExplicitEffectDragType)(event.dataTransfer)) {
|
|
1195
|
-
event.preventDefault();
|
|
1196
|
-
event.stopPropagation();
|
|
1197
|
-
setEffectDropHovered(false);
|
|
1198
|
-
(0, NotificationCenter_1.showNotification)('Could not read effect drag data', 3000);
|
|
1199
|
-
}
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
event.preventDefault();
|
|
1203
|
-
event.stopPropagation();
|
|
1204
|
-
setEffectDropHovered(false);
|
|
1205
|
-
await (0, effect_drag_and_drop_1.addEffectFromDragData)({
|
|
1206
|
-
dragData,
|
|
1207
|
-
fileName: effectDrop.fileName,
|
|
1208
|
-
nodePath: effectDrop.nodePath,
|
|
1209
|
-
clientId: effectDrop.clientId,
|
|
1210
|
-
});
|
|
1211
|
-
}, [effectDrop]);
|
|
1212
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
1213
|
-
jsx_runtime_1.jsx("polygon", { ref: polygonRef, points: points, fill: effectDropHovered ? 'rgba(0, 155, 255, 0.12)' : 'transparent', stroke: colors_1.BLUE, strokeOpacity: visible || effectDropHovered ? 1 : 0, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: target === undefined ? undefined : 'all', onPointerEnter: () => {
|
|
1214
|
-
if (!dragging) {
|
|
1215
|
-
onHoverChange(outline.key);
|
|
1216
|
-
}
|
|
1217
|
-
}, onPointerLeave: () => {
|
|
1218
|
-
if (!dragging) {
|
|
1219
|
-
onHoverChange(null);
|
|
1220
|
-
}
|
|
1221
|
-
}, onPointerDown: onPointerDown, onDragOver: effectDrop === null ? undefined : onEffectDragOver, onDragLeave: effectDrop === null ? undefined : onEffectDragLeave, onDrop: effectDrop === null ? undefined : onEffectDrop }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: polygonRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
|
|
1222
|
-
] }));
|
|
1223
|
-
};
|
|
1224
|
-
const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues, dragging, edge, outline, onDraggingChange, onContextMenuOpen, onHoverChange, onSelect, target, }) => {
|
|
1225
|
-
var _a, _b;
|
|
1226
|
-
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
1227
|
-
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
1228
|
-
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
1229
|
-
const timelinePositionRef = (0, react_1.useRef)(timelinePosition);
|
|
1230
|
-
timelinePositionRef.current = timelinePosition;
|
|
1231
|
-
const scaleDrag = (_a = target === null || target === void 0 ? void 0 : target.scaleDrag) !== null && _a !== void 0 ? _a : null;
|
|
1232
|
-
const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
|
|
1233
|
-
const lineRef = (0, react_1.useRef)(null);
|
|
1234
|
-
const edgeInfo = (0, react_1.useMemo)(() => (0, exports.getSelectedOutlineScaleEdgeInfo)(outline.points, edge), [edge, outline.points]);
|
|
1235
|
-
const onPointerDown = react_1.default.useCallback((event) => {
|
|
1236
|
-
if (event.button !== 0 || scaleDrag === null || edgeInfo === null) {
|
|
1237
|
-
return;
|
|
1238
|
-
}
|
|
1239
|
-
event.preventDefault();
|
|
1240
|
-
event.stopPropagation();
|
|
1241
|
-
const interaction = (0, exports.getOutlineSelectionInteraction)(event);
|
|
1242
|
-
const shouldUpdateSelection = !selected || interaction.shiftKey || interaction.toggleKey;
|
|
1243
|
-
if (shouldUpdateSelection && target !== undefined) {
|
|
1244
|
-
onSelect(target.selection, interaction);
|
|
1245
|
-
}
|
|
1246
|
-
if (interaction.shiftKey || interaction.toggleKey) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
onDraggingChange(true);
|
|
1250
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(edgeInfo.cursor);
|
|
1251
|
-
const startPointer = { x: event.clientX, y: event.clientY };
|
|
1252
|
-
const dragStates = (0, exports.getSelectedOutlineScaleDragStates)({
|
|
1253
|
-
dragTargets: selected ? allScaleDragTargets : [scaleDrag],
|
|
1254
|
-
getDragOverrides,
|
|
1255
|
-
timelinePosition: timelinePositionRef.current,
|
|
1256
|
-
});
|
|
1257
|
-
let lastValues = new Map();
|
|
1258
|
-
const onPointerMove = (moveEvent) => {
|
|
1259
|
-
moveEvent.preventDefault();
|
|
1260
|
-
const delta = {
|
|
1261
|
-
x: moveEvent.clientX - startPointer.x,
|
|
1262
|
-
y: moveEvent.clientY - startPointer.y,
|
|
1263
|
-
};
|
|
1264
|
-
const projectedDelta = dot(delta, edgeInfo.normal);
|
|
1265
|
-
const scaleFactor = Math.max(0.001, 1 + projectedDelta / edgeInfo.extent);
|
|
1266
|
-
lastValues = (0, exports.getSelectedOutlineScaleDragValues)({
|
|
1267
|
-
dragStates,
|
|
1268
|
-
axis: edgeInfo.axis,
|
|
1269
|
-
scaleFactor,
|
|
1270
|
-
});
|
|
1271
|
-
for (const dragState of dragStates) {
|
|
1272
|
-
const value = lastValues.get(dragState.key);
|
|
1273
|
-
if (value === undefined) {
|
|
1274
|
-
throw new Error('Expected scale drag value to be available');
|
|
1275
|
-
}
|
|
1276
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
1277
|
-
setDragOverrides(dragState.target.nodePath, scaleFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
1278
|
-
status: dragState.target.propStatus,
|
|
1279
|
-
frame: dragState.sourceFrame,
|
|
1280
|
-
value,
|
|
1281
|
-
}));
|
|
1282
|
-
}
|
|
1283
|
-
else {
|
|
1284
|
-
setDragOverrides(dragState.target.nodePath, scaleFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
const onPointerUp = () => {
|
|
1289
|
-
window.removeEventListener('pointermove', onPointerMove);
|
|
1290
|
-
window.removeEventListener('pointerup', onPointerUp);
|
|
1291
|
-
window.removeEventListener('pointercancel', onPointerUp);
|
|
1292
|
-
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
1293
|
-
onDraggingChange(false);
|
|
1294
|
-
const changes = (0, exports.getSelectedOutlineScaleDragChanges)({
|
|
1295
|
-
dragStates,
|
|
1296
|
-
lastValues,
|
|
1297
|
-
});
|
|
1298
|
-
if (changes.length === 0) {
|
|
1299
|
-
clearSelectedOutlineScaleDragOverrides({
|
|
1300
|
-
clearDragOverrides,
|
|
1301
|
-
dragStates,
|
|
1302
|
-
});
|
|
1303
|
-
return;
|
|
1304
|
-
}
|
|
1305
|
-
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
1306
|
-
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
1307
|
-
Promise.all([
|
|
1308
|
-
staticChanges.length > 0
|
|
1309
|
-
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
1310
|
-
changes: staticChanges,
|
|
1311
|
-
setPropStatuses,
|
|
1312
|
-
clientId: scaleDrag.clientId,
|
|
1313
|
-
undoLabel: changes.length > 1
|
|
1314
|
-
? 'Scale selected sequences'
|
|
1315
|
-
: 'Scale sequence',
|
|
1316
|
-
redoLabel: changes.length > 1
|
|
1317
|
-
? 'Scale selected sequences back'
|
|
1318
|
-
: 'Scale sequence back',
|
|
1319
|
-
})
|
|
1320
|
-
: Promise.resolve(),
|
|
1321
|
-
...keyframedChanges.map((change) => (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
1322
|
-
fileName: change.fileName,
|
|
1323
|
-
nodePath: change.nodePath,
|
|
1324
|
-
fieldKey: change.fieldKey,
|
|
1325
|
-
sourceFrame: change.sourceFrame,
|
|
1326
|
-
value: change.value,
|
|
1327
|
-
schema: change.schema,
|
|
1328
|
-
setPropStatuses,
|
|
1329
|
-
clientId: change.clientId,
|
|
1330
|
-
})),
|
|
1331
|
-
])
|
|
1332
|
-
.catch((err) => {
|
|
1333
|
-
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
1334
|
-
})
|
|
1335
|
-
.finally(() => {
|
|
1336
|
-
clearSelectedOutlineScaleDragOverrides({
|
|
1337
|
-
clearDragOverrides,
|
|
1338
|
-
dragStates,
|
|
1339
|
-
});
|
|
1340
|
-
});
|
|
1341
|
-
};
|
|
1342
|
-
window.addEventListener('pointermove', onPointerMove);
|
|
1343
|
-
window.addEventListener('pointerup', onPointerUp);
|
|
1344
|
-
window.addEventListener('pointercancel', onPointerUp);
|
|
1345
|
-
}, [
|
|
1346
|
-
allScaleDragTargets,
|
|
1347
|
-
clearDragOverrides,
|
|
1348
|
-
edgeInfo,
|
|
1349
|
-
getDragOverrides,
|
|
1350
|
-
onDraggingChange,
|
|
1351
|
-
onSelect,
|
|
1352
|
-
scaleDrag,
|
|
1353
|
-
selected,
|
|
1354
|
-
setPropStatuses,
|
|
1355
|
-
setDragOverrides,
|
|
1356
|
-
target,
|
|
1357
|
-
]);
|
|
1358
|
-
if (scaleDrag === null || edgeInfo === null) {
|
|
1359
|
-
return null;
|
|
1360
|
-
}
|
|
1361
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
1362
|
-
jsx_runtime_1.jsx("line", { ref: lineRef, x1: edgeInfo.start.x, y1: edgeInfo.start.y, x2: edgeInfo.end.x, y2: edgeInfo.end.y, stroke: "transparent", strokeWidth: 12, vectorEffect: "non-scaling-stroke", pointerEvents: "stroke", cursor: edgeInfo.cursor, onPointerEnter: () => {
|
|
1363
|
-
if (!dragging) {
|
|
1364
|
-
onHoverChange(outline.key);
|
|
1365
|
-
}
|
|
1366
|
-
}, onPointerLeave: () => {
|
|
1367
|
-
if (!dragging) {
|
|
1368
|
-
onHoverChange(null);
|
|
1369
|
-
}
|
|
1370
|
-
}, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: lineRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
|
|
1371
|
-
] }));
|
|
1372
|
-
};
|
|
1373
|
-
const svgPointToClientPoint = (point, rect) => {
|
|
1374
|
-
return {
|
|
1375
|
-
x: point.x + rect.left,
|
|
1376
|
-
y: point.y + rect.top,
|
|
1377
|
-
};
|
|
1378
|
-
};
|
|
1379
|
-
const SelectedOutlineRotationCornerHandle = ({ allRotationDragTargets, contextMenuValues, corner, dragging, outline, onDraggingChange, onContextMenuOpen, onHoverChange, onSelect, target, }) => {
|
|
1380
|
-
var _a, _b;
|
|
1381
|
-
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
1382
|
-
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
1383
|
-
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
1384
|
-
const timelinePositionRef = (0, react_1.useRef)(timelinePosition);
|
|
1385
|
-
timelinePositionRef.current = timelinePosition;
|
|
1386
|
-
const rotationDrag = (_a = target === null || target === void 0 ? void 0 : target.rotationDrag) !== null && _a !== void 0 ? _a : null;
|
|
1387
|
-
const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
|
|
1388
|
-
const circleRef = (0, react_1.useRef)(null);
|
|
1389
|
-
const cornerInfo = (0, react_1.useMemo)(() => (0, exports.getSelectedOutlineRotationCornerInfo)(outline.points, corner), [corner, outline.points]);
|
|
1390
|
-
const onPointerDown = react_1.default.useCallback((event) => {
|
|
1391
|
-
if (event.button !== 0 || rotationDrag === null) {
|
|
1392
|
-
return;
|
|
1393
|
-
}
|
|
1394
|
-
event.preventDefault();
|
|
1395
|
-
event.stopPropagation();
|
|
1396
|
-
const svg = event.currentTarget.ownerSVGElement;
|
|
1397
|
-
if (svg === null) {
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
const interaction = (0, exports.getOutlineSelectionInteraction)(event);
|
|
1401
|
-
const shouldUpdateSelection = !selected || interaction.shiftKey || interaction.toggleKey;
|
|
1402
|
-
if (shouldUpdateSelection && target !== undefined) {
|
|
1403
|
-
onSelect(target.selection, interaction);
|
|
1404
|
-
}
|
|
1405
|
-
if (interaction.shiftKey || interaction.toggleKey) {
|
|
1406
|
-
return;
|
|
1407
|
-
}
|
|
1408
|
-
onDraggingChange(true);
|
|
1409
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(cornerInfo.cursor);
|
|
1410
|
-
const svgRect = svg.getBoundingClientRect();
|
|
1411
|
-
const center = svgPointToClientPoint((0, exports.getSelectedOutlineRotationPivot)({
|
|
1412
|
-
dimensions: outline.dimensions,
|
|
1413
|
-
points: outline.points,
|
|
1414
|
-
transformOriginValue: rotationDrag.transformOriginValue,
|
|
1415
|
-
}), svgRect);
|
|
1416
|
-
const dragStates = (0, exports.getSelectedOutlineRotationDragStates)({
|
|
1417
|
-
dragTargets: selected ? allRotationDragTargets : [rotationDrag],
|
|
1418
|
-
getDragOverrides,
|
|
1419
|
-
timelinePosition: timelinePositionRef.current,
|
|
1420
|
-
});
|
|
1421
|
-
let previousAngle = getAngleDegrees(center, {
|
|
1422
|
-
x: event.clientX,
|
|
1423
|
-
y: event.clientY,
|
|
1424
|
-
});
|
|
1425
|
-
let accumulatedDelta = 0;
|
|
1426
|
-
let lastValues = new Map();
|
|
1427
|
-
const onPointerMove = (moveEvent) => {
|
|
1428
|
-
moveEvent.preventDefault();
|
|
1429
|
-
const nextAngle = getAngleDegrees(center, {
|
|
1430
|
-
x: moveEvent.clientX,
|
|
1431
|
-
y: moveEvent.clientY,
|
|
1432
|
-
});
|
|
1433
|
-
accumulatedDelta += (0, exports.getSelectedOutlineRotationDeltaDegrees)({
|
|
1434
|
-
from: previousAngle,
|
|
1435
|
-
to: nextAngle,
|
|
1436
|
-
});
|
|
1437
|
-
previousAngle = nextAngle;
|
|
1438
|
-
lastValues = (0, exports.getSelectedOutlineRotationDragValues)({
|
|
1439
|
-
dragStates,
|
|
1440
|
-
rotationDeltaDegrees: accumulatedDelta,
|
|
1441
|
-
});
|
|
1442
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(getRotationCursor(cornerInfo.cursorDegrees + accumulatedDelta));
|
|
1443
|
-
for (const dragState of dragStates) {
|
|
1444
|
-
const value = lastValues.get(dragState.key);
|
|
1445
|
-
if (value === undefined) {
|
|
1446
|
-
throw new Error('Expected rotation drag value to be available');
|
|
1447
|
-
}
|
|
1448
|
-
if (dragState.target.propStatus.status === 'keyframed') {
|
|
1449
|
-
setDragOverrides(dragState.target.nodePath, rotateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
1450
|
-
status: dragState.target.propStatus,
|
|
1451
|
-
frame: dragState.sourceFrame,
|
|
1452
|
-
value,
|
|
1453
|
-
}));
|
|
1454
|
-
}
|
|
1455
|
-
else {
|
|
1456
|
-
setDragOverrides(dragState.target.nodePath, rotateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
const onPointerUp = () => {
|
|
1461
|
-
window.removeEventListener('pointermove', onPointerMove);
|
|
1462
|
-
window.removeEventListener('pointerup', onPointerUp);
|
|
1463
|
-
window.removeEventListener('pointercancel', onPointerUp);
|
|
1464
|
-
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
1465
|
-
onDraggingChange(false);
|
|
1466
|
-
const changes = (0, exports.getSelectedOutlineRotationDragChanges)({
|
|
1467
|
-
dragStates,
|
|
1468
|
-
lastValues,
|
|
1469
|
-
});
|
|
1470
|
-
if (changes.length === 0) {
|
|
1471
|
-
clearSelectedOutlineRotationDragOverrides({
|
|
1472
|
-
clearDragOverrides,
|
|
1473
|
-
dragStates,
|
|
1474
|
-
});
|
|
1475
|
-
return;
|
|
1476
|
-
}
|
|
1477
|
-
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
1478
|
-
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
1479
|
-
Promise.all([
|
|
1480
|
-
staticChanges.length > 0
|
|
1481
|
-
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
1482
|
-
changes: staticChanges,
|
|
1483
|
-
setPropStatuses,
|
|
1484
|
-
clientId: rotationDrag.clientId,
|
|
1485
|
-
undoLabel: changes.length > 1
|
|
1486
|
-
? 'Rotate selected sequences'
|
|
1487
|
-
: 'Rotate sequence',
|
|
1488
|
-
redoLabel: changes.length > 1
|
|
1489
|
-
? 'Rotate selected sequences back'
|
|
1490
|
-
: 'Rotate sequence back',
|
|
1491
|
-
})
|
|
1492
|
-
: Promise.resolve(),
|
|
1493
|
-
...keyframedChanges.map((change) => (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
1494
|
-
fileName: change.fileName,
|
|
1495
|
-
nodePath: change.nodePath,
|
|
1496
|
-
fieldKey: change.fieldKey,
|
|
1497
|
-
sourceFrame: change.sourceFrame,
|
|
1498
|
-
value: change.value,
|
|
1499
|
-
schema: change.schema,
|
|
1500
|
-
setPropStatuses,
|
|
1501
|
-
clientId: change.clientId,
|
|
1502
|
-
})),
|
|
1503
|
-
])
|
|
1504
|
-
.catch((err) => {
|
|
1505
|
-
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
1506
|
-
})
|
|
1507
|
-
.finally(() => {
|
|
1508
|
-
clearSelectedOutlineRotationDragOverrides({
|
|
1509
|
-
clearDragOverrides,
|
|
1510
|
-
dragStates,
|
|
1511
|
-
});
|
|
1512
|
-
});
|
|
1513
|
-
};
|
|
1514
|
-
window.addEventListener('pointermove', onPointerMove);
|
|
1515
|
-
window.addEventListener('pointerup', onPointerUp);
|
|
1516
|
-
window.addEventListener('pointercancel', onPointerUp);
|
|
1517
|
-
}, [
|
|
1518
|
-
allRotationDragTargets,
|
|
1519
|
-
clearDragOverrides,
|
|
1520
|
-
cornerInfo,
|
|
1521
|
-
getDragOverrides,
|
|
1522
|
-
onDraggingChange,
|
|
1523
|
-
outline.dimensions,
|
|
1524
|
-
outline.points,
|
|
1525
|
-
onSelect,
|
|
1526
|
-
rotationDrag,
|
|
1527
|
-
selected,
|
|
1528
|
-
setPropStatuses,
|
|
1529
|
-
setDragOverrides,
|
|
1530
|
-
target,
|
|
1531
|
-
]);
|
|
1532
|
-
if (rotationDrag === null) {
|
|
1533
|
-
return null;
|
|
1534
|
-
}
|
|
1535
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
1536
|
-
jsx_runtime_1.jsx("circle", { ref: circleRef, cx: cornerInfo.point.x, cy: cornerInfo.point.y, r: 12, fill: "transparent", stroke: "transparent", vectorEffect: "non-scaling-stroke", pointerEvents: "all", cursor: cornerInfo.cursor, onPointerEnter: () => {
|
|
1537
|
-
if (!dragging) {
|
|
1538
|
-
onHoverChange(outline.key);
|
|
1539
|
-
}
|
|
1540
|
-
}, onPointerLeave: () => {
|
|
1541
|
-
if (!dragging) {
|
|
1542
|
-
onHoverChange(null);
|
|
1543
|
-
}
|
|
1544
|
-
}, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: circleRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
|
|
1545
|
-
] }));
|
|
1546
|
-
};
|
|
1547
|
-
const SelectedOutlineElement = ({ allDragTargets, allRotationDragTargets, allScaleDragTargets, dragging, hovered, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
|
|
1548
|
-
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
1549
|
-
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
1550
|
-
const updateResolvedStackTrace = (0, react_1.useContext)(remotion_1.Internals.SequenceStackTracesUpdateContext);
|
|
1551
|
-
const onContextMenuOpen = react_1.default.useCallback(async () => {
|
|
1552
|
-
if (target === undefined || previewServerState.type !== 'connected') {
|
|
1553
|
-
return false;
|
|
1554
|
-
}
|
|
1555
|
-
if (!target.selected) {
|
|
1556
|
-
onSelect(target.selection, { shiftKey: false, toggleKey: false });
|
|
1557
|
-
}
|
|
1558
|
-
const stack = target.sequence.getStack();
|
|
1559
|
-
let originalLocation = null;
|
|
1560
|
-
if (stack) {
|
|
1561
|
-
try {
|
|
1562
|
-
originalLocation = await (0, get_stack_1.getOriginalLocationFromStack)(stack, 'sequence');
|
|
1563
|
-
}
|
|
1564
|
-
catch (err) {
|
|
1565
|
-
(0, NotificationCenter_1.showNotification)(err.message, 2000);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
if (stack) {
|
|
1569
|
-
updateResolvedStackTrace(stack, originalLocation);
|
|
1570
|
-
}
|
|
1571
|
-
const fileLocation = (0, format_file_location_1.formatFileLocation)({
|
|
1572
|
-
location: originalLocation,
|
|
1573
|
-
root: window.remotion_cwd,
|
|
1574
|
-
});
|
|
1575
|
-
const editorName = window.remotion_editorName;
|
|
1576
|
-
const disableInteractivityDisabled = !target.sequence.showInTimeline;
|
|
1577
|
-
return [
|
|
1578
|
-
editorName
|
|
1579
|
-
? {
|
|
1580
|
-
type: 'item',
|
|
1581
|
-
id: 'show-outline-in-editor',
|
|
1582
|
-
keyHint: null,
|
|
1583
|
-
label: `Show in ${editorName}`,
|
|
1584
|
-
leftItem: null,
|
|
1585
|
-
disabled: !originalLocation,
|
|
1586
|
-
onClick: () => {
|
|
1587
|
-
if (!originalLocation) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
(0, open_in_editor_1.openOriginalPositionInEditor)(originalLocation).catch((err) => {
|
|
1591
|
-
(0, NotificationCenter_1.showNotification)(err.message, 2000);
|
|
1592
|
-
});
|
|
1593
|
-
},
|
|
1594
|
-
quickSwitcherLabel: null,
|
|
1595
|
-
subMenu: null,
|
|
1596
|
-
value: 'show-outline-in-editor',
|
|
1597
|
-
}
|
|
1598
|
-
: null,
|
|
1599
|
-
{
|
|
1600
|
-
type: 'item',
|
|
1601
|
-
id: 'copy-outline-file-location',
|
|
1602
|
-
keyHint: null,
|
|
1603
|
-
label: 'Copy file location',
|
|
1604
|
-
leftItem: null,
|
|
1605
|
-
disabled: !fileLocation,
|
|
1606
|
-
onClick: () => {
|
|
1607
|
-
if (!fileLocation) {
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
navigator.clipboard
|
|
1611
|
-
.writeText(fileLocation)
|
|
1612
|
-
.then(() => {
|
|
1613
|
-
(0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
|
|
1614
|
-
})
|
|
1615
|
-
.catch((err) => {
|
|
1616
|
-
(0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
|
|
1617
|
-
});
|
|
1618
|
-
},
|
|
1619
|
-
quickSwitcherLabel: null,
|
|
1620
|
-
subMenu: null,
|
|
1621
|
-
value: 'copy-outline-file-location',
|
|
1622
|
-
},
|
|
1623
|
-
{
|
|
1624
|
-
type: 'item',
|
|
1625
|
-
id: 'disable-outline-interactivity',
|
|
1626
|
-
keyHint: null,
|
|
1627
|
-
label: 'Disable interactivity',
|
|
1628
|
-
leftItem: null,
|
|
1629
|
-
disabled: disableInteractivityDisabled,
|
|
1630
|
-
onClick: () => {
|
|
1631
|
-
if (disableInteractivityDisabled ||
|
|
1632
|
-
previewServerState.type !== 'connected') {
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
const nodePath = target.nodePathInfo.sequenceSubscriptionKey;
|
|
1636
|
-
(0, disable_sequence_interactivity_1.disableSequenceInteractivity)({
|
|
1637
|
-
fileName: nodePath.absolutePath,
|
|
1638
|
-
nodePath,
|
|
1639
|
-
setPropStatuses,
|
|
1640
|
-
clientId: previewServerState.clientId,
|
|
1641
|
-
});
|
|
1642
|
-
},
|
|
1643
|
-
quickSwitcherLabel: null,
|
|
1644
|
-
subMenu: null,
|
|
1645
|
-
value: 'disable-outline-interactivity',
|
|
1646
|
-
},
|
|
1647
|
-
].filter(no_react_1.NoReactInternals.truthy);
|
|
1648
|
-
}, [
|
|
1649
|
-
onSelect,
|
|
1650
|
-
previewServerState,
|
|
1651
|
-
setPropStatuses,
|
|
1652
|
-
target,
|
|
1653
|
-
updateResolvedStackTrace,
|
|
1654
|
-
]);
|
|
1655
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
1656
|
-
jsx_runtime_1.jsx(SelectedOutlinePolygon, { allDragTargets: allDragTargets, contextMenuValues: emptyContextMenuValues, dragging: dragging, hovered: hovered, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, scale: scale, target: target }), (target === null || target === void 0 ? void 0 : target.containsSelection) || hovered
|
|
1657
|
-
? ['top', 'right', 'bottom', 'left'].map((edge) => (jsx_runtime_1.jsx(SelectedOutlineScaleEdgeLine, { allScaleDragTargets: allScaleDragTargets, contextMenuValues: emptyContextMenuValues, dragging: dragging, edge: edge, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: target }, edge)))
|
|
1658
|
-
: null, (target === null || target === void 0 ? void 0 : target.containsSelection) || hovered
|
|
1659
|
-
? ['top-left', 'top-right', 'bottom-right', 'bottom-left'].map((corner) => (jsx_runtime_1.jsx(SelectedOutlineRotationCornerHandle, { allRotationDragTargets: allRotationDragTargets, contextMenuValues: emptyContextMenuValues, corner: corner, dragging: dragging, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: target }, corner)))
|
|
1660
|
-
: null, jsx_runtime_1.jsx(SelectedOutlineTransformOriginHandle, { outline: outline, onDraggingChange: onDraggingChange, target: target })
|
|
1661
|
-
] }));
|
|
1662
|
-
};
|
|
1663
94
|
const SelectedOutlineOverlay = ({ scale }) => {
|
|
1664
95
|
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
1665
96
|
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
@@ -1689,14 +120,14 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1689
120
|
if (!editorShowOutlines) {
|
|
1690
121
|
return [];
|
|
1691
122
|
}
|
|
1692
|
-
const selectedSequenceKeys = (0,
|
|
1693
|
-
const sequenceKeysContainingSelection = getSequenceKeysContainingSelection(selectedItems);
|
|
1694
|
-
const selectedEffectsBySequenceKey = (0,
|
|
1695
|
-
const selectedTransformOriginInfo = getSelectedTransformOriginInfo(selectedItems);
|
|
123
|
+
const selectedSequenceKeys = (0, selected_outline_measurement_1.getSelectedSequenceKeys)(selectedItems);
|
|
124
|
+
const sequenceKeysContainingSelection = (0, selected_outline_measurement_1.getSequenceKeysContainingSelection)(selectedItems);
|
|
125
|
+
const selectedEffectsBySequenceKey = (0, selected_outline_measurement_1.getSelectedEffectFieldsBySequenceKey)(selectedItems);
|
|
126
|
+
const selectedTransformOriginInfo = (0, selected_outline_measurement_1.getSelectedTransformOriginInfo)(selectedItems);
|
|
1696
127
|
const clientId = previewServerState.type === 'connected'
|
|
1697
128
|
? previewServerState.clientId
|
|
1698
129
|
: null;
|
|
1699
|
-
return (0,
|
|
130
|
+
return (0, selected_outline_measurement_1.getSequencesWithSelectableOutlines)({
|
|
1700
131
|
sequences,
|
|
1701
132
|
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
1702
133
|
}).map(({ key, keyframeDisplayOffset, nodePathInfo, sequence }) => {
|
|
@@ -1709,22 +140,22 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1709
140
|
const containsSelection = sequenceKeysContainingSelection.has(key);
|
|
1710
141
|
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
1711
142
|
const { controls } = sequence;
|
|
1712
|
-
const fieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[translateFieldKey];
|
|
143
|
+
const fieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[selected_outline_types_1.translateFieldKey];
|
|
1713
144
|
const nodePropStatuses = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath);
|
|
1714
|
-
const propStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[translateFieldKey];
|
|
1715
|
-
const scaleFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[scaleFieldKey];
|
|
1716
|
-
const scalePropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[scaleFieldKey];
|
|
1717
|
-
const rotationFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[rotateFieldKey];
|
|
1718
|
-
const rotationPropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[rotateFieldKey];
|
|
1719
|
-
const transformOriginFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[transformOriginFieldKey];
|
|
1720
|
-
const transformOriginPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[transformOriginFieldKey];
|
|
145
|
+
const propStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.translateFieldKey];
|
|
146
|
+
const scaleFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[selected_outline_types_1.scaleFieldKey];
|
|
147
|
+
const scalePropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.scaleFieldKey];
|
|
148
|
+
const rotationFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[selected_outline_types_1.rotateFieldKey];
|
|
149
|
+
const rotationPropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[selected_outline_types_1.rotateFieldKey];
|
|
150
|
+
const transformOriginFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[selected_outline_types_1.transformOriginFieldKey];
|
|
151
|
+
const transformOriginPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.transformOriginFieldKey];
|
|
1721
152
|
const rotationSourceFrame = timelinePosition - keyframeDisplayOffset;
|
|
1722
153
|
const transformOriginValueForRotation = (transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
1723
154
|
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
1724
155
|
(transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed')
|
|
1725
156
|
? String((_c = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1726
157
|
propStatus: transformOriginPropStatus,
|
|
1727
|
-
dragOverrideValue: ((_b = getDragOverrides(nodePath)) !== null && _b !== void 0 ? _b : {})[transformOriginFieldKey],
|
|
158
|
+
dragOverrideValue: ((_b = getDragOverrides(nodePath)) !== null && _b !== void 0 ? _b : {})[selected_outline_types_1.transformOriginFieldKey],
|
|
1728
159
|
defaultValue: transformOriginFieldSchema.default,
|
|
1729
160
|
frame: rotationSourceFrame,
|
|
1730
161
|
shouldResortToDefaultValueIfUndefined: true,
|
|
@@ -1805,10 +236,10 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1805
236
|
keyframeDisplayOffset,
|
|
1806
237
|
linked: getScaleLockState({
|
|
1807
238
|
nodePath,
|
|
1808
|
-
fieldKey: scaleFieldKey,
|
|
239
|
+
fieldKey: selected_outline_types_1.scaleFieldKey,
|
|
1809
240
|
defaultValue: (() => {
|
|
1810
241
|
var _a;
|
|
1811
|
-
const dragOverrideValue = ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[scaleFieldKey];
|
|
242
|
+
const dragOverrideValue = ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[selected_outline_types_1.scaleFieldKey];
|
|
1812
243
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1813
244
|
propStatus: scalePropStatus,
|
|
1814
245
|
dragOverrideValue,
|
|
@@ -1844,7 +275,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1844
275
|
originPropStatus: transformOriginPropStatus,
|
|
1845
276
|
originValue: String((_e = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1846
277
|
propStatus: transformOriginPropStatus,
|
|
1847
|
-
dragOverrideValue: ((_d = getDragOverrides(nodePath)) !== null && _d !== void 0 ? _d : {})[transformOriginFieldKey],
|
|
278
|
+
dragOverrideValue: ((_d = getDragOverrides(nodePath)) !== null && _d !== void 0 ? _d : {})[selected_outline_types_1.transformOriginFieldKey],
|
|
1848
279
|
defaultValue: transformOriginFieldSchema.default,
|
|
1849
280
|
frame: transformOriginSourceFrame,
|
|
1850
281
|
shouldResortToDefaultValueIfUndefined: true,
|
|
@@ -1853,7 +284,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1853
284
|
(rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed'
|
|
1854
285
|
? ((_g = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1855
286
|
propStatus: rotationPropStatus,
|
|
1856
|
-
dragOverrideValue: ((_f = getDragOverrides(nodePath)) !== null && _f !== void 0 ? _f : {})[rotateFieldKey],
|
|
287
|
+
dragOverrideValue: ((_f = getDragOverrides(nodePath)) !== null && _f !== void 0 ? _f : {})[selected_outline_types_1.rotateFieldKey],
|
|
1857
288
|
defaultValue: (rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css'
|
|
1858
289
|
? rotationFieldSchema.default
|
|
1859
290
|
: '0deg',
|
|
@@ -1865,7 +296,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1865
296
|
(scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed'
|
|
1866
297
|
? String((_j = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1867
298
|
propStatus: scalePropStatus,
|
|
1868
|
-
dragOverrideValue: ((_h = getDragOverrides(nodePath)) !== null && _h !== void 0 ? _h : {})[scaleFieldKey],
|
|
299
|
+
dragOverrideValue: ((_h = getDragOverrides(nodePath)) !== null && _h !== void 0 ? _h : {})[selected_outline_types_1.scaleFieldKey],
|
|
1869
300
|
defaultValue: (scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale'
|
|
1870
301
|
? scaleFieldSchema.default
|
|
1871
302
|
: 1,
|
|
@@ -1879,7 +310,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1879
310
|
translatePropStatus: propStatus,
|
|
1880
311
|
translateValue: String((_l = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1881
312
|
propStatus,
|
|
1882
|
-
dragOverrideValue: ((_k = getDragOverrides(nodePath)) !== null && _k !== void 0 ? _k : {})[translateFieldKey],
|
|
313
|
+
dragOverrideValue: ((_k = getDragOverrides(nodePath)) !== null && _k !== void 0 ? _k : {})[selected_outline_types_1.translateFieldKey],
|
|
1883
314
|
defaultValue: fieldSchema.default,
|
|
1884
315
|
frame: transformOriginSourceFrame,
|
|
1885
316
|
shouldResortToDefaultValueIfUndefined: true,
|
|
@@ -1937,12 +368,12 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1937
368
|
return;
|
|
1938
369
|
}
|
|
1939
370
|
keyboardNudgeSessionRef.current = null;
|
|
1940
|
-
const changes = (0,
|
|
371
|
+
const changes = (0, selected_outline_drag_1.getSelectedOutlineDragChanges)({
|
|
1941
372
|
dragStates: session.dragStates,
|
|
1942
373
|
lastValues: session.lastValues,
|
|
1943
374
|
});
|
|
1944
375
|
if (changes.length === 0) {
|
|
1945
|
-
clearSelectedOutlineDragOverrides({
|
|
376
|
+
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
1946
377
|
clearDragOverrides,
|
|
1947
378
|
dragStates: session.dragStates,
|
|
1948
379
|
});
|
|
@@ -1977,7 +408,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1977
408
|
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
1978
409
|
})
|
|
1979
410
|
.finally(() => {
|
|
1980
|
-
clearSelectedOutlineDragOverrides({
|
|
411
|
+
(0, selected_outline_drag_1.clearSelectedOutlineDragOverrides)({
|
|
1981
412
|
clearDragOverrides,
|
|
1982
413
|
dragStates: session.dragStates,
|
|
1983
414
|
});
|
|
@@ -2050,7 +481,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2050
481
|
}, [frameBack, frameForward, getCurrentFrame, seek]);
|
|
2051
482
|
const onArrowKeyDown = (0, react_1.useCallback)((event) => {
|
|
2052
483
|
var _a;
|
|
2053
|
-
const direction = getSelectedOutlineKeyboardNudgeDirection(event.key);
|
|
484
|
+
const direction = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDirection)(event.key);
|
|
2054
485
|
if (direction === null) {
|
|
2055
486
|
return;
|
|
2056
487
|
}
|
|
@@ -2072,7 +503,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2072
503
|
clientId: firstDragTarget.clientId,
|
|
2073
504
|
deltaX: 0,
|
|
2074
505
|
deltaY: 0,
|
|
2075
|
-
dragStates: getSelectedOutlineDragStates({
|
|
506
|
+
dragStates: (0, selected_outline_drag_1.getSelectedOutlineDragStates)({
|
|
2076
507
|
dragTargets: allDragTargets,
|
|
2077
508
|
getDragOverrides,
|
|
2078
509
|
timelinePosition,
|
|
@@ -2081,7 +512,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2081
512
|
};
|
|
2082
513
|
})();
|
|
2083
514
|
keyboardNudgeSessionRef.current = activeSession;
|
|
2084
|
-
const nextDeltas = (0,
|
|
515
|
+
const nextDeltas = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDeltas)({
|
|
2085
516
|
deltaX: activeSession.deltaX,
|
|
2086
517
|
deltaY: activeSession.deltaY,
|
|
2087
518
|
direction,
|
|
@@ -2089,7 +520,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2089
520
|
});
|
|
2090
521
|
activeSession.deltaX = nextDeltas.deltaX;
|
|
2091
522
|
activeSession.deltaY = nextDeltas.deltaY;
|
|
2092
|
-
const lastValues = (0,
|
|
523
|
+
const lastValues = (0, selected_outline_drag_1.getSelectedOutlineDragValues)({
|
|
2093
524
|
dragStates: activeSession.dragStates,
|
|
2094
525
|
deltaX: activeSession.deltaX,
|
|
2095
526
|
deltaY: activeSession.deltaY,
|
|
@@ -2101,14 +532,14 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2101
532
|
throw new Error('Expected drag value to be available');
|
|
2102
533
|
}
|
|
2103
534
|
if (dragState.target.propStatus.status === 'keyframed') {
|
|
2104
|
-
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
535
|
+
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
2105
536
|
status: dragState.target.propStatus,
|
|
2106
537
|
frame: dragState.sourceFrame,
|
|
2107
538
|
value,
|
|
2108
539
|
}));
|
|
2109
540
|
}
|
|
2110
541
|
else {
|
|
2111
|
-
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
542
|
+
setDragOverrides(dragState.target.nodePath, selected_outline_types_1.translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
2112
543
|
}
|
|
2113
544
|
}
|
|
2114
545
|
}, [
|
|
@@ -2120,7 +551,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2120
551
|
timelinePosition,
|
|
2121
552
|
]);
|
|
2122
553
|
const onArrowKeyUp = (0, react_1.useCallback)((event) => {
|
|
2123
|
-
const direction = getSelectedOutlineKeyboardNudgeDirection(event.key);
|
|
554
|
+
const direction = (0, selected_outline_drag_1.getSelectedOutlineKeyboardNudgeDirection)(event.key);
|
|
2124
555
|
if (direction === null || keyboardNudgeSessionRef.current === null) {
|
|
2125
556
|
return;
|
|
2126
557
|
}
|
|
@@ -2160,8 +591,8 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2160
591
|
let animationFrame = null;
|
|
2161
592
|
const updateOutlines = () => {
|
|
2162
593
|
if (overlayRef.current) {
|
|
2163
|
-
const nextOutlines = measureOutlines(overlayRef.current, outlineTargets);
|
|
2164
|
-
setOutlines((prevOutlines) => outlinesAreEqual(prevOutlines, nextOutlines)
|
|
594
|
+
const nextOutlines = (0, selected_outline_measurement_1.measureOutlines)(overlayRef.current, outlineTargets);
|
|
595
|
+
setOutlines((prevOutlines) => (0, selected_outline_measurement_1.outlinesAreEqual)(prevOutlines, nextOutlines)
|
|
2165
596
|
? prevOutlines
|
|
2166
597
|
: nextOutlines);
|
|
2167
598
|
}
|
|
@@ -2177,6 +608,6 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
2177
608
|
if (outlineTargets.length === 0) {
|
|
2178
609
|
return null;
|
|
2179
610
|
}
|
|
2180
|
-
return (jsx_runtime_1.jsxs("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: [outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement, { allDragTargets: allDragTargets, allRotationDragTargets: allRotationDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: hoveredOutlineKey === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: setHoveredOutlineKey, onSelect: selectItem, scale: scale, target: targetsByKey.get(outline.key) }, outline.key))), outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
|
|
611
|
+
return (jsx_runtime_1.jsxs("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: [outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineElement, { allDragTargets: allDragTargets, allRotationDragTargets: allRotationDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: hoveredOutlineKey === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: setHoveredOutlineKey, onSelect: selectItem, scale: scale, target: targetsByKey.get(outline.key) }, outline.key))), outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
|
|
2181
612
|
};
|
|
2182
613
|
exports.SelectedOutlineOverlay = SelectedOutlineOverlay;
|