@remotion/studio 4.0.474 → 4.0.476
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 +6 -0
- package/dist/components/ColorPicker/ColorPicker.js +4 -31
- package/dist/components/ColorPicker/ColorPickerPopup.d.ts +6 -0
- package/dist/components/ColorPicker/ColorPickerPopup.js +11 -6
- package/dist/components/CompositionSelectorItem.js +4 -4
- package/dist/components/Editor.js +4 -1
- package/dist/components/GlobalKeybindings.js +12 -0
- package/dist/components/KeyboardShortcutsExplainer.js +24 -0
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/ComboBox.js +1 -0
- package/dist/components/NewComposition/InputDragger.d.ts +6 -0
- package/dist/components/NewComposition/InputDragger.js +40 -14
- package/dist/components/NewComposition/RenameComposition.js +8 -1
- package/dist/components/NewComposition/RenameFolder.js +8 -1
- package/dist/components/NewComposition/RenameStaticFile.js +11 -1
- package/dist/components/Notifications/Notification.js +5 -4
- package/dist/components/Notifications/NotificationCenter.js +1 -1
- package/dist/components/ObserveDefaultPropsContext.js +6 -2
- package/dist/components/PlayPause.js +22 -66
- package/dist/components/PreviewToolbar.js +17 -3
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +2 -1
- package/dist/components/SelectedOutlineOverlay.d.ts +104 -42
- package/dist/components/SelectedOutlineOverlay.js +1278 -336
- package/dist/components/SelectedOutlineUvControls.d.ts +17 -0
- package/dist/components/SelectedOutlineUvControls.js +167 -0
- package/dist/components/StudioCanvasCapture.d.ts +5 -0
- package/dist/components/StudioCanvasCapture.js +40 -0
- package/dist/components/Timeline/EasingEditorModal.d.ts +11 -0
- package/dist/components/Timeline/EasingEditorModal.js +247 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +1 -0
- package/dist/components/Timeline/Timeline.js +10 -7
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +64 -35
- package/dist/components/Timeline/TimelineDragHandler.js +2 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +1 -1
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +1 -1
- package/dist/components/Timeline/TimelineHeightContainer.js +2 -0
- package/dist/components/Timeline/TimelineItemStack.js +3 -56
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +7 -0
- package/dist/components/Timeline/TimelineKeyframeControls.js +259 -62
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +4 -2
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +128 -3
- package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +7 -0
- package/dist/components/Timeline/TimelineKeyframeTracksContext.js +17 -0
- package/dist/components/Timeline/TimelineMediaInfo.js +4 -24
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
- package/dist/components/Timeline/TimelineRotationField.js +21 -39
- package/dist/components/Timeline/TimelineScaleField.js +1 -1
- package/dist/components/Timeline/TimelineScrollable.js +19 -3
- package/dist/components/Timeline/TimelineSelection.d.ts +67 -3
- package/dist/components/Timeline/TimelineSelection.js +289 -32
- package/dist/components/Timeline/TimelineSequence.js +17 -9
- package/dist/components/Timeline/TimelineSequenceItem.js +328 -168
- package/dist/components/Timeline/TimelineSequenceName.d.ts +4 -2
- package/dist/components/Timeline/TimelineSequenceName.js +70 -19
- package/dist/components/Timeline/TimelineSequencePropItem.js +1 -1
- package/dist/components/Timeline/TimelineTimeIndicators.js +4 -2
- package/dist/components/Timeline/TimelineTransformOriginField.d.ts +11 -0
- package/dist/components/Timeline/TimelineTransformOriginField.js +138 -0
- package/dist/components/Timeline/TimelineTranslateField.js +1 -1
- package/dist/components/Timeline/TimelineUvCoordinateField.js +1 -1
- package/dist/components/Timeline/call-add-keyframe.d.ts +17 -0
- package/dist/components/Timeline/call-add-keyframe.js +65 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +23 -13
- package/dist/components/Timeline/disable-sequence-interactivity.d.ts +8 -0
- package/dist/components/Timeline/disable-sequence-interactivity.js +24 -0
- package/dist/components/Timeline/reset-selected-timeline-props.js +15 -7
- package/dist/components/Timeline/timeline-rotation-utils.d.ts +2 -0
- package/dist/components/Timeline/timeline-rotation-utils.js +34 -0
- package/dist/components/Timeline/transform-origin-utils.d.ts +24 -0
- package/dist/components/Timeline/transform-origin-utils.js +170 -0
- package/dist/components/Timeline/update-selected-easing.d.ts +35 -0
- package/dist/components/Timeline/update-selected-easing.js +133 -0
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +1 -0
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +28 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +8 -13
- package/dist/components/canvas-capture-enabled.d.ts +1 -0
- package/dist/components/canvas-capture-enabled.js +4 -0
- package/dist/components/effect-drag-and-drop.d.ts +11 -0
- package/dist/components/effect-drag-and-drop.js +73 -0
- package/dist/components/selected-outline-geometry.d.ts +20 -0
- package/dist/components/selected-outline-geometry.js +18 -0
- package/dist/components/selected-outline-uv.d.ts +46 -0
- package/dist/components/selected-outline-uv.js +240 -0
- package/dist/esm/{chunk-xjvc8qen.js → chunk-0atarw3p.js} +8779 -5352
- package/dist/esm/internals.mjs +8779 -5352
- package/dist/esm/previewEntry.mjs +8789 -5362
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/colors.d.ts +0 -1
- package/dist/helpers/colors.js +1 -2
- package/dist/state/modals.d.ts +2 -1
- package/package.json +11 -10
|
@@ -33,9 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SelectedOutlineOverlay = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineDragValues = exports.getSequencesWithSelectableOutlines = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSelectedSequenceKeys = exports.
|
|
37
|
-
exports.constrainUv = constrainUv;
|
|
36
|
+
exports.SelectedOutlineOverlay = exports.compensateTranslateForTransformOrigin = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragChanges = exports.isSelectedOutlineDragPastThreshold = exports.applySelectedOutlineDragAxisLock = exports.getSelectedOutlineDragValues = exports.getSequencesWithSelectableOutlines = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSelectedSequenceKeys = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineDragThresholdPx = void 0;
|
|
38
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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");
|
|
@@ -45,19 +45,34 @@ const colors_1 = require("../helpers/colors");
|
|
|
45
45
|
const format_file_location_1 = require("../helpers/format-file-location");
|
|
46
46
|
const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
|
|
47
47
|
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
48
|
+
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
48
49
|
const editor_outlines_1 = require("../state/editor-outlines");
|
|
49
50
|
const scale_lock_1 = require("../state/scale-lock");
|
|
50
51
|
const ContextMenu_1 = require("./ContextMenu");
|
|
52
|
+
const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
53
|
+
const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
|
|
51
54
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
55
|
+
const selected_outline_geometry_1 = require("./selected-outline-geometry");
|
|
56
|
+
const selected_outline_uv_1 = require("./selected-outline-uv");
|
|
57
|
+
const SelectedOutlineUvControls_1 = require("./SelectedOutlineUvControls");
|
|
52
58
|
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
53
|
-
const
|
|
59
|
+
const disable_sequence_interactivity_1 = require("./Timeline/disable-sequence-interactivity");
|
|
60
|
+
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");
|
|
54
62
|
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
|
+
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
55
66
|
const timeline_translate_utils_1 = require("./Timeline/timeline-translate-utils");
|
|
56
67
|
const TimelineScaleField_1 = require("./Timeline/TimelineScaleField");
|
|
57
68
|
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
58
69
|
const get_stack_1 = require("./Timeline/TimelineStack/get-stack");
|
|
70
|
+
const transform_origin_utils_1 = require("./Timeline/transform-origin-utils");
|
|
59
71
|
const translateFieldKey = 'style.translate';
|
|
60
72
|
const scaleFieldKey = 'style.scale';
|
|
73
|
+
const rotateFieldKey = 'style.rotate';
|
|
74
|
+
const transformOriginFieldKey = 'style.transformOrigin';
|
|
75
|
+
exports.selectedOutlineDragThresholdPx = 4;
|
|
61
76
|
const outlineContainer = {
|
|
62
77
|
position: 'absolute',
|
|
63
78
|
inset: 0,
|
|
@@ -66,188 +81,93 @@ const outlineContainer = {
|
|
|
66
81
|
};
|
|
67
82
|
const emptyContextMenuValues = [];
|
|
68
83
|
const pointToString = (point) => `${point.x},${point.y}`;
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
value.length === 2 &&
|
|
72
|
-
value.every((item) => typeof item === 'number' && Number.isFinite(item))) {
|
|
73
|
-
return [value[0], value[1]];
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
};
|
|
77
|
-
const tuplesEqual = (left, right) => {
|
|
78
|
-
if (!Array.isArray(left) || left.length !== 2) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return left[0] === right[0] && left[1] === right[1];
|
|
82
|
-
};
|
|
83
|
-
const mix = (from, to, progress) => {
|
|
84
|
-
return from + (to - from) * progress;
|
|
84
|
+
const midpoint = (from, to) => {
|
|
85
|
+
return (0, selected_outline_geometry_1.mixPoint)(from, to, 0.5);
|
|
85
86
|
};
|
|
86
|
-
const
|
|
87
|
+
const getOutlineCenter = (points) => {
|
|
88
|
+
const [tl, tr, br, bl] = points;
|
|
87
89
|
return {
|
|
88
|
-
x:
|
|
89
|
-
y:
|
|
90
|
+
x: (tl.x + tr.x + br.x + bl.x) / 4,
|
|
91
|
+
y: (tl.y + tr.y + br.y + bl.y) / 4,
|
|
90
92
|
};
|
|
91
93
|
};
|
|
92
|
-
const midpoint = (from, to) => {
|
|
93
|
-
return mixPoint(from, to, 0.5);
|
|
94
|
-
};
|
|
95
94
|
const dot = (left, right) => {
|
|
96
95
|
return left.x * right.x + left.y * right.y;
|
|
97
96
|
};
|
|
98
97
|
const vectorLength = (vector) => {
|
|
99
98
|
return Math.hypot(vector.x, vector.y);
|
|
100
99
|
};
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const top = mixPoint(tl, tr, uv[0]);
|
|
104
|
-
const bottom = mixPoint(bl, br, uv[0]);
|
|
105
|
-
return mixPoint(top, bottom, uv[1]);
|
|
100
|
+
const vectorBetween = (from, to) => {
|
|
101
|
+
return { x: to.x - from.x, y: to.y - from.y };
|
|
106
102
|
};
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const [tl, tr, br, bl] = points;
|
|
110
|
-
const dx1 = tr.x - br.x;
|
|
111
|
-
const dx2 = bl.x - br.x;
|
|
112
|
-
const dx3 = tl.x - tr.x + br.x - bl.x;
|
|
113
|
-
const dy1 = tr.y - br.y;
|
|
114
|
-
const dy2 = bl.y - br.y;
|
|
115
|
-
const dy3 = tl.y - tr.y + br.y - bl.y;
|
|
116
|
-
let g = 0;
|
|
117
|
-
let h = 0;
|
|
118
|
-
if (Math.abs(dx3) > projectiveEpsilon || Math.abs(dy3) > projectiveEpsilon) {
|
|
119
|
-
const determinant = dx1 * dy2 - dx2 * dy1;
|
|
120
|
-
if (Math.abs(determinant) < projectiveEpsilon) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
g = (dx3 * dy2 - dx2 * dy3) / determinant;
|
|
124
|
-
h = (dx1 * dy3 - dx3 * dy1) / determinant;
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
a: tr.x - tl.x + g * tr.x,
|
|
128
|
-
b: bl.x - tl.x + h * bl.x,
|
|
129
|
-
c: tl.x,
|
|
130
|
-
d: tr.y - tl.y + g * tr.y,
|
|
131
|
-
e: bl.y - tl.y + h * bl.y,
|
|
132
|
-
f: tl.y,
|
|
133
|
-
g,
|
|
134
|
-
h,
|
|
135
|
-
};
|
|
103
|
+
const getAngleDegrees = (from, to) => {
|
|
104
|
+
return Math.atan2(to.y - from.y, to.x - from.x) * (180 / Math.PI);
|
|
136
105
|
};
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
x: (transform.a * uv[0] + transform.b * uv[1] + transform.c) / denominator,
|
|
141
|
-
y: (transform.d * uv[0] + transform.e * uv[1] + transform.f) / denominator,
|
|
142
|
-
};
|
|
106
|
+
const getSelectedOutlineRotationDeltaDegrees = ({ from, to, }) => {
|
|
107
|
+
return ((((to - from) % 360) + 540) % 360) - 180;
|
|
143
108
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
: applyProjectiveTransform(transform, uv);
|
|
109
|
+
exports.getSelectedOutlineRotationDeltaDegrees = getSelectedOutlineRotationDeltaDegrees;
|
|
110
|
+
const normalizeRotationCursorDegrees = (rotation) => {
|
|
111
|
+
const normalizedRotation = ((rotation % 360) + 360) % 360;
|
|
112
|
+
return Number(normalizedRotation.toFixed(3));
|
|
149
113
|
};
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
for (const handle of handles) {
|
|
159
|
-
const targetFieldKey = handle.fieldSchema.lineTo;
|
|
160
|
-
if (targetFieldKey === undefined || targetFieldKey === handle.fieldKey) {
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
const target = handlesByField.get(`${handle.effectIndex}\u0000${targetFieldKey}`);
|
|
164
|
-
if (target === undefined) {
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
const pairKey = [
|
|
168
|
-
handle.effectIndex,
|
|
169
|
-
...[handle.fieldKey, targetFieldKey].sort(),
|
|
170
|
-
].join('\u0000');
|
|
171
|
-
if (seenPairs.has(pairKey)) {
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
seenPairs.add(pairKey);
|
|
175
|
-
lines.push({
|
|
176
|
-
key: `${handle.effectIndex}-${handle.fieldKey}-${targetFieldKey}`,
|
|
177
|
-
from: (0, exports.getUvHandlePosition)(points, handle.value),
|
|
178
|
-
to: (0, exports.getUvHandlePosition)(points, target.value),
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
return lines;
|
|
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`;
|
|
182
122
|
};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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);
|
|
186
132
|
};
|
|
187
|
-
const
|
|
133
|
+
const getRotationCursorDegrees = (points, corner) => normalizeRotationCursorDegrees(getOutlineRotationDegrees(points) + rotationCursorBaseDegrees[corner]);
|
|
134
|
+
const getSelectedOutlineRotationCornerInfo = (points, corner) => {
|
|
188
135
|
const [tl, tr, br, bl] = points;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const determinant = du.x * dv.y - du.y * dv.x;
|
|
204
|
-
if (Math.abs(determinant) < 0.000001) {
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
u -= (errorX * dv.y - errorY * dv.x) / determinant;
|
|
208
|
-
v -= (du.x * errorY - du.y * errorX) / determinant;
|
|
209
|
-
}
|
|
210
|
-
return [u, v];
|
|
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
|
+
};
|
|
211
150
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
return
|
|
151
|
+
exports.getSelectedOutlineRotationCornerInfo = getSelectedOutlineRotationCornerInfo;
|
|
152
|
+
const getSelectedOutlineRotationPivot = ({ dimensions, points, transformOriginValue, }) => {
|
|
153
|
+
if (dimensions === null) {
|
|
154
|
+
return getOutlineCenter(points);
|
|
216
155
|
}
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (Math.abs(determinant) < projectiveEpsilon) {
|
|
221
|
-
return getBilinearUvCoordinateForPoint(points, point);
|
|
156
|
+
const parsed = (0, transform_origin_utils_1.parseTransformOrigin)(transformOriginValue);
|
|
157
|
+
if (parsed === null) {
|
|
158
|
+
return getOutlineCenter(points);
|
|
222
159
|
}
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const inverseH = transform.b * transform.g - transform.a * transform.h;
|
|
231
|
-
const inverseI = transform.a * transform.e - transform.b * transform.d;
|
|
232
|
-
const denominator = inverseG * point.x + inverseH * point.y + inverseI;
|
|
233
|
-
if (Math.abs(denominator) < projectiveEpsilon) {
|
|
234
|
-
return getBilinearUvCoordinateForPoint(points, point);
|
|
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);
|
|
235
167
|
}
|
|
236
|
-
return
|
|
237
|
-
(inverseA * point.x + inverseB * point.y + inverseC) / denominator,
|
|
238
|
-
(inverseD * point.x + inverseE * point.y + inverseF) / denominator,
|
|
239
|
-
];
|
|
240
|
-
};
|
|
241
|
-
exports.getUvCoordinateForPoint = getUvCoordinateForPoint;
|
|
242
|
-
const clamp = (value, min, max) => {
|
|
243
|
-
return Math.min(max, Math.max(min, value));
|
|
168
|
+
return (0, selected_outline_uv_1.getUvHandlePosition)(points, uv);
|
|
244
169
|
};
|
|
245
|
-
|
|
246
|
-
var _a, _b;
|
|
247
|
-
const min = (_a = schema.min) !== null && _a !== void 0 ? _a : -Infinity;
|
|
248
|
-
const max = (_b = schema.max) !== null && _b !== void 0 ? _b : Infinity;
|
|
249
|
-
return [clamp(value[0], min, max), clamp(value[1], min, max)];
|
|
250
|
-
}
|
|
170
|
+
exports.getSelectedOutlineRotationPivot = getSelectedOutlineRotationPivot;
|
|
251
171
|
const rectToPoints = (elementRect, containerRect) => {
|
|
252
172
|
const left = elementRect.left - containerRect.left;
|
|
253
173
|
const top = elementRect.top - containerRect.top;
|
|
@@ -260,6 +180,23 @@ const rectToPoints = (elementRect, containerRect) => {
|
|
|
260
180
|
{ x: left, y: bottom },
|
|
261
181
|
];
|
|
262
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;
|
|
263
200
|
const quadToPoints = (quad, containerRect) => {
|
|
264
201
|
// `getBoxQuads`/the ponyfill returns the quad in viewport coordinates.
|
|
265
202
|
// The overlay <svg> is unscaled (the canvas `scale()`/pan live on a sibling
|
|
@@ -275,11 +212,50 @@ const quadToPoints = (quad, containerRect) => {
|
|
|
275
212
|
{ x: quad.p4.x - containerRect.left, y: quad.p4.y - containerRect.top },
|
|
276
213
|
];
|
|
277
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
|
+
};
|
|
278
251
|
const getElementOutlinePoints = (element, containerRect) => {
|
|
279
252
|
const elementRect = element.getBoundingClientRect();
|
|
280
253
|
if (elementRect.width === 0 && elementRect.height === 0) {
|
|
281
254
|
return null;
|
|
282
255
|
}
|
|
256
|
+
if (isSvgSvgElement(element)) {
|
|
257
|
+
return getSvgSvgElementOutlinePoints(element, containerRect);
|
|
258
|
+
}
|
|
283
259
|
const quads = (0, get_box_quads_ponyfill_1.getBoxQuadsPonyfill)(element, {
|
|
284
260
|
box: 'border',
|
|
285
261
|
});
|
|
@@ -329,6 +305,31 @@ const getSelectedEffectFieldsBySequenceKey = (selectedItems) => {
|
|
|
329
305
|
return selectedEffects;
|
|
330
306
|
};
|
|
331
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
|
+
};
|
|
332
333
|
const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths, }) => {
|
|
333
334
|
return (0, calculate_timeline_1.calculateTimeline)({
|
|
334
335
|
sequences: [...sequences],
|
|
@@ -338,7 +339,8 @@ const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths,
|
|
|
338
339
|
if (track.nodePathInfo === null) {
|
|
339
340
|
return false;
|
|
340
341
|
}
|
|
341
|
-
return track.
|
|
342
|
+
return (track.sequence.showInTimeline &&
|
|
343
|
+
track.nodePathInfo.auxiliaryKeys.length === 0);
|
|
342
344
|
})
|
|
343
345
|
.filter((track) => track.sequence.refForOutline !== null)
|
|
344
346
|
.sort((a, b) => a.depth - b.depth)
|
|
@@ -356,71 +358,6 @@ const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths,
|
|
|
356
358
|
});
|
|
357
359
|
};
|
|
358
360
|
exports.getSequencesWithSelectableOutlines = getSequencesWithSelectableOutlines;
|
|
359
|
-
const getSelectedUvHandles = ({ propStatuses, clientId, getEffectDragOverrides, nodePath, selectedEffects, sequence, }) => {
|
|
360
|
-
if (clientId === null || selectedEffects === undefined) {
|
|
361
|
-
return [];
|
|
362
|
-
}
|
|
363
|
-
const handles = [];
|
|
364
|
-
for (const [effectIndex, selectedFields] of selectedEffects) {
|
|
365
|
-
const effect = sequence.effects[effectIndex];
|
|
366
|
-
if (!effect) {
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
|
|
370
|
-
propStatuses,
|
|
371
|
-
nodePath,
|
|
372
|
-
effectIndex,
|
|
373
|
-
});
|
|
374
|
-
if (effectStatus.type !== 'can-update-effect') {
|
|
375
|
-
continue;
|
|
376
|
-
}
|
|
377
|
-
const dragOverrides = getEffectDragOverrides(nodePath, effectIndex);
|
|
378
|
-
const activeSchema = remotion_1.Internals.flattenActiveSchema(effect.schema, (key) => {
|
|
379
|
-
const dragOverride = remotion_1.Internals.getStaticDragOverrideValue(dragOverrides[key]);
|
|
380
|
-
if (dragOverride !== undefined) {
|
|
381
|
-
return dragOverride;
|
|
382
|
-
}
|
|
383
|
-
const propStatus = effectStatus.props[key];
|
|
384
|
-
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) !== 'static') {
|
|
385
|
-
return undefined;
|
|
386
|
-
}
|
|
387
|
-
return propStatus.codeValue;
|
|
388
|
-
});
|
|
389
|
-
for (const [fieldKey, fieldSchema] of Object.entries(activeSchema)) {
|
|
390
|
-
if (fieldSchema.type !== 'uv-coordinate' ||
|
|
391
|
-
(!selectedFields.allFields && !selectedFields.fieldKeys.has(fieldKey))) {
|
|
392
|
-
continue;
|
|
393
|
-
}
|
|
394
|
-
const propStatus = effectStatus.props[fieldKey];
|
|
395
|
-
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) !== 'static') {
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
const dragOverrideValue = dragOverrides[fieldKey];
|
|
399
|
-
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
400
|
-
propStatus,
|
|
401
|
-
dragOverrideValue,
|
|
402
|
-
defaultValue: fieldSchema.default,
|
|
403
|
-
shouldResortToDefaultValueIfUndefined: true,
|
|
404
|
-
});
|
|
405
|
-
const value = parseUvCoordinate(effectiveValue);
|
|
406
|
-
if (value === null) {
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
handles.push({
|
|
410
|
-
clientId,
|
|
411
|
-
propStatus,
|
|
412
|
-
effectIndex,
|
|
413
|
-
fieldDefault: fieldSchema.default,
|
|
414
|
-
fieldKey,
|
|
415
|
-
fieldSchema,
|
|
416
|
-
nodePath,
|
|
417
|
-
schema: effect.schema,
|
|
418
|
-
value,
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
return handles;
|
|
423
|
-
};
|
|
424
361
|
const measureOutlines = (container, targets) => {
|
|
425
362
|
const containerRect = container.getBoundingClientRect();
|
|
426
363
|
const outlines = [];
|
|
@@ -433,11 +370,26 @@ const measureOutlines = (container, targets) => {
|
|
|
433
370
|
if (points === null) {
|
|
434
371
|
continue;
|
|
435
372
|
}
|
|
436
|
-
outlines.push({
|
|
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
|
+
});
|
|
437
388
|
}
|
|
438
389
|
return outlines;
|
|
439
390
|
};
|
|
440
391
|
const outlinesAreEqual = (a, b) => {
|
|
392
|
+
var _a, _b, _c, _d;
|
|
441
393
|
if (a.length !== b.length) {
|
|
442
394
|
return false;
|
|
443
395
|
}
|
|
@@ -445,6 +397,10 @@ const outlinesAreEqual = (a, b) => {
|
|
|
445
397
|
if (a[i].key !== b[i].key) {
|
|
446
398
|
return false;
|
|
447
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
|
+
}
|
|
448
404
|
for (let j = 0; j < a[i].points.length; j++) {
|
|
449
405
|
if (Math.abs(a[i].points[j].x - b[i].points[j].x) > 0.01 ||
|
|
450
406
|
Math.abs(a[i].points[j].y - b[i].points[j].y) > 0.01) {
|
|
@@ -486,6 +442,20 @@ const getSelectedOutlineDragValues = ({ dragStates, deltaX, deltaY, }) => {
|
|
|
486
442
|
]));
|
|
487
443
|
};
|
|
488
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;
|
|
489
459
|
const getSelectedOutlineDragChanges = ({ dragStates, lastValues, }) => {
|
|
490
460
|
const changes = [];
|
|
491
461
|
for (const dragState of dragStates) {
|
|
@@ -530,6 +500,22 @@ const getSelectedOutlineDragChanges = ({ dragStates, lastValues, }) => {
|
|
|
530
500
|
return changes;
|
|
531
501
|
};
|
|
532
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;
|
|
533
519
|
const getSelectedOutlineScaleEdgeInfo = (points, edge) => {
|
|
534
520
|
const [tl, tr, br, bl] = points;
|
|
535
521
|
const edgePoints = {
|
|
@@ -555,14 +541,16 @@ const getSelectedOutlineScaleEdgeInfo = (points, edge) => {
|
|
|
555
541
|
};
|
|
556
542
|
};
|
|
557
543
|
exports.getSelectedOutlineScaleEdgeInfo = getSelectedOutlineScaleEdgeInfo;
|
|
558
|
-
const getSelectedOutlineScaleDragStates = ({ dragTargets, getDragOverrides, }) => {
|
|
544
|
+
const getSelectedOutlineScaleDragStates = ({ dragTargets, getDragOverrides, timelinePosition, }) => {
|
|
559
545
|
return dragTargets.map((target) => {
|
|
560
546
|
var _a;
|
|
561
547
|
const dragOverrideValue = ((_a = getDragOverrides(target.nodePath)) !== null && _a !== void 0 ? _a : {})[scaleFieldKey];
|
|
548
|
+
const sourceFrame = timelinePosition - target.keyframeDisplayOffset;
|
|
562
549
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
563
550
|
propStatus: target.propStatus,
|
|
564
551
|
dragOverrideValue,
|
|
565
552
|
defaultValue: target.fieldDefault,
|
|
553
|
+
frame: sourceFrame,
|
|
566
554
|
shouldResortToDefaultValueIfUndefined: true,
|
|
567
555
|
});
|
|
568
556
|
const [startX, startY, startZ] = no_react_1.NoReactInternals.parseScaleValue(effectiveValue);
|
|
@@ -571,6 +559,7 @@ const getSelectedOutlineScaleDragStates = ({ dragTargets, getDragOverrides, }) =
|
|
|
571
559
|
? JSON.stringify(target.fieldDefault)
|
|
572
560
|
: null,
|
|
573
561
|
key: remotion_1.Internals.makeSequencePropsSubscriptionKey(target.nodePath),
|
|
562
|
+
sourceFrame,
|
|
574
563
|
startX,
|
|
575
564
|
startY,
|
|
576
565
|
startZ,
|
|
@@ -584,10 +573,14 @@ const getSelectedOutlineScaleDragValues = ({ axis, dragStates, scaleFactor, }) =
|
|
|
584
573
|
var _a, _b;
|
|
585
574
|
const min = (_a = dragState.target.fieldSchema.min) !== null && _a !== void 0 ? _a : -Infinity;
|
|
586
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
|
+
});
|
|
587
580
|
const baseX = dragState.startX;
|
|
588
581
|
const baseY = dragState.startY;
|
|
589
582
|
const newValue = (axis === 'x' ? baseX : baseY) * scaleFactor;
|
|
590
|
-
const [
|
|
583
|
+
const [rawX, rawY] = dragState.target.linked
|
|
591
584
|
? (0, TimelineScaleField_1.getLinkedScale)({
|
|
592
585
|
axis,
|
|
593
586
|
newValue,
|
|
@@ -597,8 +590,10 @@ const getSelectedOutlineScaleDragValues = ({ axis, dragStates, scaleFactor, }) =
|
|
|
597
590
|
max,
|
|
598
591
|
})
|
|
599
592
|
: axis === 'x'
|
|
600
|
-
? [clamp(newValue, min, max), baseY]
|
|
601
|
-
: [baseX, clamp(newValue, min, max)];
|
|
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);
|
|
602
597
|
return [
|
|
603
598
|
dragState.key,
|
|
604
599
|
no_react_1.NoReactInternals.serializeScaleValue([x, y, dragState.startZ]),
|
|
@@ -607,10 +602,32 @@ const getSelectedOutlineScaleDragValues = ({ axis, dragStates, scaleFactor, }) =
|
|
|
607
602
|
};
|
|
608
603
|
exports.getSelectedOutlineScaleDragValues = getSelectedOutlineScaleDragValues;
|
|
609
604
|
const getSelectedOutlineScaleDragChanges = ({ dragStates, lastValues, }) => {
|
|
610
|
-
|
|
605
|
+
const changes = [];
|
|
606
|
+
for (const dragState of dragStates) {
|
|
611
607
|
const value = lastValues.get(dragState.key);
|
|
612
608
|
if (value === undefined) {
|
|
613
|
-
|
|
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;
|
|
614
631
|
}
|
|
615
632
|
const stringifiedValue = JSON.stringify(value);
|
|
616
633
|
const shouldSave = stringifiedValue !==
|
|
@@ -618,33 +635,375 @@ const getSelectedOutlineScaleDragChanges = ({ dragStates, lastValues, }) => {
|
|
|
618
635
|
!(dragState.defaultValue === stringifiedValue &&
|
|
619
636
|
dragState.target.propStatus.codeValue === undefined);
|
|
620
637
|
if (!shouldSave) {
|
|
621
|
-
|
|
638
|
+
continue;
|
|
622
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
|
+
});
|
|
623
683
|
return [
|
|
624
|
-
|
|
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',
|
|
625
708
|
fileName: dragState.target.nodePath.absolutePath,
|
|
626
709
|
nodePath: dragState.target.nodePath,
|
|
627
|
-
fieldKey:
|
|
710
|
+
fieldKey: rotateFieldKey,
|
|
711
|
+
sourceFrame: dragState.sourceFrame,
|
|
628
712
|
value,
|
|
629
|
-
defaultValue: dragState.defaultValue,
|
|
630
713
|
schema: dragState.target.schema,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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;
|
|
634
736
|
};
|
|
635
|
-
exports.
|
|
737
|
+
exports.getSelectedOutlineRotationDragChanges = getSelectedOutlineRotationDragChanges;
|
|
636
738
|
const clearSelectedOutlineDragOverrides = ({ clearDragOverrides, dragStates, }) => {
|
|
637
739
|
for (const dragState of dragStates) {
|
|
638
740
|
clearDragOverrides(dragState.target.nodePath);
|
|
639
741
|
}
|
|
640
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
|
+
};
|
|
641
758
|
const clearSelectedOutlineScaleDragOverrides = ({ clearDragOverrides, dragStates, }) => {
|
|
642
759
|
for (const dragState of dragStates) {
|
|
643
760
|
clearDragOverrides(dragState.target.nodePath);
|
|
644
761
|
}
|
|
645
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
|
+
};
|
|
646
1005
|
const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, hovered, onContextMenuOpen, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
|
|
647
|
-
var _a, _b, _c;
|
|
1006
|
+
var _a, _b, _c, _d;
|
|
648
1007
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
649
1008
|
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
650
1009
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
@@ -655,6 +1014,8 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
655
1014
|
const drag = (_a = target === null || target === void 0 ? void 0 : target.drag) !== null && _a !== void 0 ? _a : null;
|
|
656
1015
|
const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
|
|
657
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);
|
|
658
1019
|
const visible = containsSelection || hovered;
|
|
659
1020
|
const onPointerDown = react_1.default.useCallback((event) => {
|
|
660
1021
|
if (event.button !== 0 || target === undefined) {
|
|
@@ -670,7 +1031,6 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
670
1031
|
if (drag === null || interaction.shiftKey || interaction.toggleKey) {
|
|
671
1032
|
return;
|
|
672
1033
|
}
|
|
673
|
-
onDraggingChange(true);
|
|
674
1034
|
const startPointerX = event.clientX;
|
|
675
1035
|
const startPointerY = event.clientY;
|
|
676
1036
|
const dragStates = getSelectedOutlineDragStates({
|
|
@@ -679,12 +1039,32 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
679
1039
|
timelinePosition: timelinePositionRef.current,
|
|
680
1040
|
});
|
|
681
1041
|
let lastValues = new Map();
|
|
682
|
-
|
|
683
|
-
|
|
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
|
+
});
|
|
684
1064
|
lastValues = (0, exports.getSelectedOutlineDragValues)({
|
|
685
1065
|
dragStates,
|
|
686
|
-
deltaX:
|
|
687
|
-
deltaY:
|
|
1066
|
+
deltaX: dragDelta.deltaX,
|
|
1067
|
+
deltaY: dragDelta.deltaY,
|
|
688
1068
|
});
|
|
689
1069
|
for (const dragState of dragStates) {
|
|
690
1070
|
const value = lastValues.get(dragState.key);
|
|
@@ -703,11 +1083,33 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
703
1083
|
}
|
|
704
1084
|
}
|
|
705
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
|
+
};
|
|
706
1104
|
const onPointerUp = () => {
|
|
707
1105
|
window.removeEventListener('pointermove', onPointerMove);
|
|
708
1106
|
window.removeEventListener('pointerup', onPointerUp);
|
|
709
1107
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
710
|
-
|
|
1108
|
+
window.removeEventListener('keydown', onKeyChange);
|
|
1109
|
+
window.removeEventListener('keyup', onKeyChange);
|
|
1110
|
+
if (dragStarted) {
|
|
1111
|
+
onDraggingChange(false);
|
|
1112
|
+
}
|
|
711
1113
|
const changes = (0, exports.getSelectedOutlineDragChanges)({
|
|
712
1114
|
dragStates,
|
|
713
1115
|
lastValues,
|
|
@@ -753,6 +1155,8 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
753
1155
|
window.addEventListener('pointermove', onPointerMove);
|
|
754
1156
|
window.addEventListener('pointerup', onPointerUp);
|
|
755
1157
|
window.addEventListener('pointercancel', onPointerUp);
|
|
1158
|
+
window.addEventListener('keydown', onKeyChange);
|
|
1159
|
+
window.addEventListener('keyup', onKeyChange);
|
|
756
1160
|
}, [
|
|
757
1161
|
allDragTargets,
|
|
758
1162
|
clearDragOverrides,
|
|
@@ -766,8 +1170,47 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
766
1170
|
setDragOverrides,
|
|
767
1171
|
target,
|
|
768
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]);
|
|
769
1212
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
770
|
-
jsx_runtime_1.jsx("polygon", { ref: polygonRef, points: points, fill:
|
|
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: () => {
|
|
771
1214
|
if (!dragging) {
|
|
772
1215
|
onHoverChange(outline.key);
|
|
773
1216
|
}
|
|
@@ -775,13 +1218,16 @@ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, h
|
|
|
775
1218
|
if (!dragging) {
|
|
776
1219
|
onHoverChange(null);
|
|
777
1220
|
}
|
|
778
|
-
}, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: polygonRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
|
|
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 })
|
|
779
1222
|
] }));
|
|
780
1223
|
};
|
|
781
1224
|
const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues, dragging, edge, outline, onDraggingChange, onContextMenuOpen, onHoverChange, onSelect, target, }) => {
|
|
782
1225
|
var _a, _b;
|
|
783
1226
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
784
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;
|
|
785
1231
|
const scaleDrag = (_a = target === null || target === void 0 ? void 0 : target.scaleDrag) !== null && _a !== void 0 ? _a : null;
|
|
786
1232
|
const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
|
|
787
1233
|
const lineRef = (0, react_1.useRef)(null);
|
|
@@ -801,10 +1247,12 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
801
1247
|
return;
|
|
802
1248
|
}
|
|
803
1249
|
onDraggingChange(true);
|
|
1250
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(edgeInfo.cursor);
|
|
804
1251
|
const startPointer = { x: event.clientX, y: event.clientY };
|
|
805
1252
|
const dragStates = (0, exports.getSelectedOutlineScaleDragStates)({
|
|
806
1253
|
dragTargets: selected ? allScaleDragTargets : [scaleDrag],
|
|
807
1254
|
getDragOverrides,
|
|
1255
|
+
timelinePosition: timelinePositionRef.current,
|
|
808
1256
|
});
|
|
809
1257
|
let lastValues = new Map();
|
|
810
1258
|
const onPointerMove = (moveEvent) => {
|
|
@@ -825,13 +1273,23 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
825
1273
|
if (value === undefined) {
|
|
826
1274
|
throw new Error('Expected scale drag value to be available');
|
|
827
1275
|
}
|
|
828
|
-
|
|
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
|
+
}
|
|
829
1286
|
}
|
|
830
1287
|
};
|
|
831
1288
|
const onPointerUp = () => {
|
|
832
1289
|
window.removeEventListener('pointermove', onPointerMove);
|
|
833
1290
|
window.removeEventListener('pointerup', onPointerUp);
|
|
834
1291
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
1292
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
835
1293
|
onDraggingChange(false);
|
|
836
1294
|
const changes = (0, exports.getSelectedOutlineScaleDragChanges)({
|
|
837
1295
|
dragStates,
|
|
@@ -844,15 +1302,33 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
844
1302
|
});
|
|
845
1303
|
return;
|
|
846
1304
|
}
|
|
847
|
-
(
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
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
|
+
])
|
|
856
1332
|
.catch((err) => {
|
|
857
1333
|
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
858
1334
|
})
|
|
@@ -894,21 +1370,25 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
894
1370
|
}, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: lineRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
|
|
895
1371
|
] }));
|
|
896
1372
|
};
|
|
897
|
-
const
|
|
1373
|
+
const svgPointToClientPoint = (point, rect) => {
|
|
898
1374
|
return {
|
|
899
|
-
x:
|
|
900
|
-
y:
|
|
1375
|
+
x: point.x + rect.left,
|
|
1376
|
+
y: point.y + rect.top,
|
|
901
1377
|
};
|
|
902
1378
|
};
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
};
|
|
907
|
-
const
|
|
908
|
-
const
|
|
909
|
-
|
|
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]);
|
|
910
1390
|
const onPointerDown = react_1.default.useCallback((event) => {
|
|
911
|
-
if (event.button !== 0) {
|
|
1391
|
+
if (event.button !== 0 || rotationDrag === null) {
|
|
912
1392
|
return;
|
|
913
1393
|
}
|
|
914
1394
|
event.preventDefault();
|
|
@@ -917,70 +1397,156 @@ const SelectedUvHandleCircle = ({ handle, onDraggingChange, outline }) => {
|
|
|
917
1397
|
if (svg === null) {
|
|
918
1398
|
return;
|
|
919
1399
|
}
|
|
920
|
-
const
|
|
921
|
-
|
|
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
|
+
}
|
|
922
1408
|
onDraggingChange(true);
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
};
|
|
935
|
-
|
|
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();
|
|
936
1427
|
const onPointerMove = (moveEvent) => {
|
|
937
1428
|
moveEvent.preventDefault();
|
|
938
|
-
|
|
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
|
+
}
|
|
939
1459
|
};
|
|
940
1460
|
const onPointerUp = () => {
|
|
941
1461
|
window.removeEventListener('pointermove', onPointerMove);
|
|
942
1462
|
window.removeEventListener('pointerup', onPointerUp);
|
|
943
1463
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
1464
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
944
1465
|
onDraggingChange(false);
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1466
|
+
const changes = (0, exports.getSelectedOutlineRotationDragChanges)({
|
|
1467
|
+
dragStates,
|
|
1468
|
+
lastValues,
|
|
1469
|
+
});
|
|
1470
|
+
if (changes.length === 0) {
|
|
1471
|
+
clearSelectedOutlineRotationDragOverrides({
|
|
1472
|
+
clearDragOverrides,
|
|
1473
|
+
dragStates,
|
|
1474
|
+
});
|
|
952
1475
|
return;
|
|
953
1476
|
}
|
|
954
|
-
(
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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
|
+
});
|
|
967
1512
|
});
|
|
968
1513
|
};
|
|
969
1514
|
window.addEventListener('pointermove', onPointerMove);
|
|
970
1515
|
window.addEventListener('pointerup', onPointerUp);
|
|
971
1516
|
window.addEventListener('pointercancel', onPointerUp);
|
|
972
1517
|
}, [
|
|
973
|
-
|
|
974
|
-
|
|
1518
|
+
allRotationDragTargets,
|
|
1519
|
+
clearDragOverrides,
|
|
1520
|
+
cornerInfo,
|
|
1521
|
+
getDragOverrides,
|
|
975
1522
|
onDraggingChange,
|
|
1523
|
+
outline.dimensions,
|
|
976
1524
|
outline.points,
|
|
1525
|
+
onSelect,
|
|
1526
|
+
rotationDrag,
|
|
1527
|
+
selected,
|
|
977
1528
|
setPropStatuses,
|
|
978
|
-
|
|
1529
|
+
setDragOverrides,
|
|
1530
|
+
target,
|
|
979
1531
|
]);
|
|
980
|
-
|
|
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
|
+
] }));
|
|
981
1546
|
};
|
|
982
|
-
const SelectedOutlineElement = ({ allDragTargets, allScaleDragTargets, dragging, hovered, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
|
|
1547
|
+
const SelectedOutlineElement = ({ allDragTargets, allRotationDragTargets, allScaleDragTargets, dragging, hovered, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
|
|
983
1548
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
1549
|
+
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
984
1550
|
const updateResolvedStackTrace = (0, react_1.useContext)(remotion_1.Internals.SequenceStackTracesUpdateContext);
|
|
985
1551
|
const onContextMenuOpen = react_1.default.useCallback(async () => {
|
|
986
1552
|
if (target === undefined || previewServerState.type !== 'connected') {
|
|
@@ -1007,6 +1573,7 @@ const SelectedOutlineElement = ({ allDragTargets, allScaleDragTargets, dragging,
|
|
|
1007
1573
|
root: window.remotion_cwd,
|
|
1008
1574
|
});
|
|
1009
1575
|
const editorName = window.remotion_editorName;
|
|
1576
|
+
const disableInteractivityDisabled = !target.sequence.showInTimeline;
|
|
1010
1577
|
return [
|
|
1011
1578
|
editorName
|
|
1012
1579
|
? {
|
|
@@ -1053,24 +1620,45 @@ const SelectedOutlineElement = ({ allDragTargets, allScaleDragTargets, dragging,
|
|
|
1053
1620
|
subMenu: null,
|
|
1054
1621
|
value: 'copy-outline-file-location',
|
|
1055
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
|
+
},
|
|
1056
1647
|
].filter(no_react_1.NoReactInternals.truthy);
|
|
1057
|
-
}, [
|
|
1648
|
+
}, [
|
|
1649
|
+
onSelect,
|
|
1650
|
+
previewServerState,
|
|
1651
|
+
setPropStatuses,
|
|
1652
|
+
target,
|
|
1653
|
+
updateResolvedStackTrace,
|
|
1654
|
+
]);
|
|
1058
1655
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
1059
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
|
|
1060
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)))
|
|
1061
|
-
: null
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
return null;
|
|
1066
|
-
}
|
|
1067
|
-
return (jsx_runtime_1.jsx(SelectedUvHandleConnectionLines, { handles: target.uvHandles, outline: outline }));
|
|
1068
|
-
};
|
|
1069
|
-
const SelectedOutlineUvHandleCircleLayer = ({ onDraggingChange, outline, target }) => {
|
|
1070
|
-
if (!(target === null || target === void 0 ? void 0 : target.containsSelection) || target.uvHandles.length === 0) {
|
|
1071
|
-
return null;
|
|
1072
|
-
}
|
|
1073
|
-
return (jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: target.uvHandles.map((handle) => (jsx_runtime_1.jsx(SelectedUvHandleCircle, { handle: handle, onDraggingChange: onDraggingChange, outline: outline }, `${handle.effectIndex}-${handle.fieldKey}`))) }));
|
|
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
|
+
] }));
|
|
1074
1662
|
};
|
|
1075
1663
|
const SelectedOutlineOverlay = ({ scale }) => {
|
|
1076
1664
|
const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
@@ -1079,12 +1667,18 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1079
1667
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
1080
1668
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
1081
1669
|
const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
1670
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
1082
1671
|
const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
1083
1672
|
const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
1673
|
+
const { frameBack, frameForward, getCurrentFrame, seek } = player_1.PlayerInternals.usePlayer();
|
|
1674
|
+
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
1675
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
1084
1676
|
const [outlines, setOutlines] = (0, react_1.useState)([]);
|
|
1085
1677
|
const [hoveredOutlineKey, setHoveredOutlineKey] = (0, react_1.useState)(null);
|
|
1086
1678
|
const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
|
|
1087
1679
|
const overlayRef = (0, react_1.useRef)(null);
|
|
1680
|
+
const keyboardNudgeSessionRef = (0, react_1.useRef)(null);
|
|
1681
|
+
const saveKeyboardNudgeSessionRef = (0, react_1.useRef)(() => undefined);
|
|
1088
1682
|
const onDraggingChange = react_1.default.useCallback((dragging) => {
|
|
1089
1683
|
setDraggingOutline(dragging);
|
|
1090
1684
|
if (dragging) {
|
|
@@ -1092,12 +1686,13 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1092
1686
|
}
|
|
1093
1687
|
}, []);
|
|
1094
1688
|
const outlineTargets = (0, react_1.useMemo)(() => {
|
|
1095
|
-
if (!
|
|
1689
|
+
if (!editorShowOutlines) {
|
|
1096
1690
|
return [];
|
|
1097
1691
|
}
|
|
1098
1692
|
const selectedSequenceKeys = (0, exports.getSelectedSequenceKeys)(selectedItems);
|
|
1099
1693
|
const sequenceKeysContainingSelection = getSequenceKeysContainingSelection(selectedItems);
|
|
1100
1694
|
const selectedEffectsBySequenceKey = (0, exports.getSelectedEffectFieldsBySequenceKey)(selectedItems);
|
|
1695
|
+
const selectedTransformOriginInfo = getSelectedTransformOriginInfo(selectedItems);
|
|
1101
1696
|
const clientId = previewServerState.type === 'connected'
|
|
1102
1697
|
? previewServerState.clientId
|
|
1103
1698
|
: null;
|
|
@@ -1105,7 +1700,8 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1105
1700
|
sequences,
|
|
1106
1701
|
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
1107
1702
|
}).map(({ key, keyframeDisplayOffset, nodePathInfo, sequence }) => {
|
|
1108
|
-
var _a
|
|
1703
|
+
var _a;
|
|
1704
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1109
1705
|
if (sequence.refForOutline === null) {
|
|
1110
1706
|
throw new Error('Expected sequence to have a ref for outline');
|
|
1111
1707
|
}
|
|
@@ -1114,23 +1710,77 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1114
1710
|
const nodePath = nodePathInfo.sequenceSubscriptionKey;
|
|
1115
1711
|
const { controls } = sequence;
|
|
1116
1712
|
const fieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[translateFieldKey];
|
|
1117
|
-
const
|
|
1713
|
+
const nodePropStatuses = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath);
|
|
1714
|
+
const propStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[translateFieldKey];
|
|
1118
1715
|
const scaleFieldSchema = controls === null || controls === void 0 ? void 0 : controls.schema[scaleFieldKey];
|
|
1119
|
-
const scalePropStatus =
|
|
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];
|
|
1721
|
+
const rotationSourceFrame = timelinePosition - keyframeDisplayOffset;
|
|
1722
|
+
const transformOriginValueForRotation = (transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
1723
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
1724
|
+
(transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed')
|
|
1725
|
+
? String((_c = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1726
|
+
propStatus: transformOriginPropStatus,
|
|
1727
|
+
dragOverrideValue: ((_b = getDragOverrides(nodePath)) !== null && _b !== void 0 ? _b : {})[transformOriginFieldKey],
|
|
1728
|
+
defaultValue: transformOriginFieldSchema.default,
|
|
1729
|
+
frame: rotationSourceFrame,
|
|
1730
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
1731
|
+
})) !== null && _c !== void 0 ? _c : transformOriginFieldSchema.default)
|
|
1732
|
+
: '50% 50%';
|
|
1120
1733
|
const canDragStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
1121
1734
|
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
1122
1735
|
propStatus.interpolationFunction === 'interpolate');
|
|
1736
|
+
const canRotationDragStatus = (rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'static' ||
|
|
1737
|
+
((rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed' &&
|
|
1738
|
+
rotationPropStatus.interpolationFunction === 'interpolate');
|
|
1123
1739
|
const canDrag = previewServerState.type === 'connected' &&
|
|
1124
1740
|
controls !== null &&
|
|
1125
1741
|
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
1126
1742
|
canDragStatus;
|
|
1743
|
+
const canScaleDragStatus = (scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'static' ||
|
|
1744
|
+
((scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed' &&
|
|
1745
|
+
scalePropStatus.interpolationFunction === 'interpolate');
|
|
1127
1746
|
const canScaleDrag = previewServerState.type === 'connected' &&
|
|
1128
1747
|
controls !== null &&
|
|
1129
1748
|
(scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale' &&
|
|
1130
|
-
|
|
1749
|
+
canScaleDragStatus;
|
|
1750
|
+
const canRotationDrag = previewServerState.type === 'connected' &&
|
|
1751
|
+
controls !== null &&
|
|
1752
|
+
(rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css' &&
|
|
1753
|
+
canRotationDragStatus;
|
|
1754
|
+
const selectedForTransformOrigin = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.sequenceKey) === key;
|
|
1755
|
+
const transformOriginSourceFrame = (selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === null ||
|
|
1756
|
+
(selectedTransformOriginInfo === null || selectedTransformOriginInfo === void 0 ? void 0 : selectedTransformOriginInfo.displayFrame) === undefined
|
|
1757
|
+
? timelinePosition - keyframeDisplayOffset
|
|
1758
|
+
: selectedTransformOriginInfo.displayFrame - keyframeDisplayOffset;
|
|
1759
|
+
const canTransformOriginStatus = (transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
|
|
1760
|
+
((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed' &&
|
|
1761
|
+
transformOriginPropStatus.interpolationFunction === 'interpolate');
|
|
1762
|
+
const canTransformOriginTranslateStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
|
|
1763
|
+
((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
|
|
1764
|
+
propStatus.interpolationFunction === 'interpolate');
|
|
1765
|
+
const canTransformOriginDrag = previewServerState.type === 'connected' &&
|
|
1766
|
+
selectedForTransformOrigin &&
|
|
1767
|
+
controls !== null &&
|
|
1768
|
+
(transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
|
|
1769
|
+
(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) === 'translate' &&
|
|
1770
|
+
canTransformOriginStatus &&
|
|
1771
|
+
canTransformOriginTranslateStatus;
|
|
1772
|
+
const canDropEffect = previewServerState.type === 'connected' &&
|
|
1773
|
+
(controls === null || controls === void 0 ? void 0 : controls.supportsEffects) === true;
|
|
1131
1774
|
return {
|
|
1132
1775
|
key,
|
|
1133
1776
|
containsSelection,
|
|
1777
|
+
effectDrop: canDropEffect
|
|
1778
|
+
? {
|
|
1779
|
+
clientId: previewServerState.clientId,
|
|
1780
|
+
fileName: nodePath.absolutePath,
|
|
1781
|
+
nodePath,
|
|
1782
|
+
}
|
|
1783
|
+
: null,
|
|
1134
1784
|
nodePathInfo,
|
|
1135
1785
|
ref: sequence.refForOutline,
|
|
1136
1786
|
selected,
|
|
@@ -1152,6 +1802,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1152
1802
|
clientId: previewServerState.clientId,
|
|
1153
1803
|
fieldDefault: scaleFieldSchema.default,
|
|
1154
1804
|
fieldSchema: scaleFieldSchema,
|
|
1805
|
+
keyframeDisplayOffset,
|
|
1155
1806
|
linked: getScaleLockState({
|
|
1156
1807
|
nodePath,
|
|
1157
1808
|
fieldKey: scaleFieldKey,
|
|
@@ -1172,14 +1823,78 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1172
1823
|
schema: controls.schema,
|
|
1173
1824
|
}
|
|
1174
1825
|
: null,
|
|
1826
|
+
rotationDrag: canRotationDrag
|
|
1827
|
+
? {
|
|
1828
|
+
propStatus: rotationPropStatus,
|
|
1829
|
+
clientId: previewServerState.clientId,
|
|
1830
|
+
fieldDefault: rotationFieldSchema.default,
|
|
1831
|
+
fieldSchema: rotationFieldSchema,
|
|
1832
|
+
keyframeDisplayOffset,
|
|
1833
|
+
nodePath,
|
|
1834
|
+
schema: controls.schema,
|
|
1835
|
+
transformOriginValue: transformOriginValueForRotation,
|
|
1836
|
+
}
|
|
1837
|
+
: null,
|
|
1838
|
+
transformOriginDrag: canTransformOriginDrag
|
|
1839
|
+
? {
|
|
1840
|
+
clientId: previewServerState.clientId,
|
|
1841
|
+
keyframeDisplayOffset,
|
|
1842
|
+
nodePath,
|
|
1843
|
+
originDefault: transformOriginFieldSchema.default,
|
|
1844
|
+
originPropStatus: transformOriginPropStatus,
|
|
1845
|
+
originValue: String((_e = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1846
|
+
propStatus: transformOriginPropStatus,
|
|
1847
|
+
dragOverrideValue: ((_d = getDragOverrides(nodePath)) !== null && _d !== void 0 ? _d : {})[transformOriginFieldKey],
|
|
1848
|
+
defaultValue: transformOriginFieldSchema.default,
|
|
1849
|
+
frame: transformOriginSourceFrame,
|
|
1850
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
1851
|
+
})) !== null && _e !== void 0 ? _e : transformOriginFieldSchema.default),
|
|
1852
|
+
rotateValue: String((rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'static' ||
|
|
1853
|
+
(rotationPropStatus === null || rotationPropStatus === void 0 ? void 0 : rotationPropStatus.status) === 'keyframed'
|
|
1854
|
+
? ((_g = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1855
|
+
propStatus: rotationPropStatus,
|
|
1856
|
+
dragOverrideValue: ((_f = getDragOverrides(nodePath)) !== null && _f !== void 0 ? _f : {})[rotateFieldKey],
|
|
1857
|
+
defaultValue: (rotationFieldSchema === null || rotationFieldSchema === void 0 ? void 0 : rotationFieldSchema.type) === 'rotation-css'
|
|
1858
|
+
? rotationFieldSchema.default
|
|
1859
|
+
: '0deg',
|
|
1860
|
+
frame: transformOriginSourceFrame,
|
|
1861
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
1862
|
+
})) !== null && _g !== void 0 ? _g : '0deg')
|
|
1863
|
+
: '0deg'),
|
|
1864
|
+
scaleValue: (scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'static' ||
|
|
1865
|
+
(scalePropStatus === null || scalePropStatus === void 0 ? void 0 : scalePropStatus.status) === 'keyframed'
|
|
1866
|
+
? String((_j = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1867
|
+
propStatus: scalePropStatus,
|
|
1868
|
+
dragOverrideValue: ((_h = getDragOverrides(nodePath)) !== null && _h !== void 0 ? _h : {})[scaleFieldKey],
|
|
1869
|
+
defaultValue: (scaleFieldSchema === null || scaleFieldSchema === void 0 ? void 0 : scaleFieldSchema.type) === 'scale'
|
|
1870
|
+
? scaleFieldSchema.default
|
|
1871
|
+
: 1,
|
|
1872
|
+
frame: transformOriginSourceFrame,
|
|
1873
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
1874
|
+
})) !== null && _j !== void 0 ? _j : 1)
|
|
1875
|
+
: '1',
|
|
1876
|
+
schema: controls.schema,
|
|
1877
|
+
sourceFrame: transformOriginSourceFrame,
|
|
1878
|
+
translateDefault: fieldSchema.default,
|
|
1879
|
+
translatePropStatus: propStatus,
|
|
1880
|
+
translateValue: String((_l = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
1881
|
+
propStatus,
|
|
1882
|
+
dragOverrideValue: ((_k = getDragOverrides(nodePath)) !== null && _k !== void 0 ? _k : {})[translateFieldKey],
|
|
1883
|
+
defaultValue: fieldSchema.default,
|
|
1884
|
+
frame: transformOriginSourceFrame,
|
|
1885
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
1886
|
+
})) !== null && _l !== void 0 ? _l : fieldSchema.default),
|
|
1887
|
+
}
|
|
1888
|
+
: null,
|
|
1175
1889
|
uvHandles: containsSelection
|
|
1176
|
-
? getSelectedUvHandles({
|
|
1890
|
+
? (0, selected_outline_uv_1.getSelectedUvHandles)({
|
|
1177
1891
|
propStatuses,
|
|
1178
1892
|
clientId,
|
|
1179
1893
|
getEffectDragOverrides,
|
|
1180
1894
|
nodePath,
|
|
1181
1895
|
selectedEffects: selectedEffectsBySequenceKey.get(key),
|
|
1182
1896
|
sequence,
|
|
1897
|
+
sourceFrame: timelinePosition - keyframeDisplayOffset,
|
|
1183
1898
|
})
|
|
1184
1899
|
: [],
|
|
1185
1900
|
};
|
|
@@ -1194,6 +1909,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1194
1909
|
previewServerState,
|
|
1195
1910
|
selectedItems,
|
|
1196
1911
|
sequences,
|
|
1912
|
+
timelinePosition,
|
|
1197
1913
|
]);
|
|
1198
1914
|
(0, react_1.useEffect)(() => {
|
|
1199
1915
|
if (hoveredOutlineKey !== null &&
|
|
@@ -1210,6 +1926,232 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1210
1926
|
const allScaleDragTargets = (0, react_1.useMemo)(() => {
|
|
1211
1927
|
return outlineTargets.flatMap((target) => target.selected && target.scaleDrag !== null ? [target.scaleDrag] : []);
|
|
1212
1928
|
}, [outlineTargets]);
|
|
1929
|
+
const allRotationDragTargets = (0, react_1.useMemo)(() => {
|
|
1930
|
+
return outlineTargets.flatMap((target) => target.selected && target.rotationDrag !== null
|
|
1931
|
+
? [target.rotationDrag]
|
|
1932
|
+
: []);
|
|
1933
|
+
}, [outlineTargets]);
|
|
1934
|
+
const saveKeyboardNudgeSession = (0, react_1.useCallback)(() => {
|
|
1935
|
+
const session = keyboardNudgeSessionRef.current;
|
|
1936
|
+
if (session === null) {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
keyboardNudgeSessionRef.current = null;
|
|
1940
|
+
const changes = (0, exports.getSelectedOutlineDragChanges)({
|
|
1941
|
+
dragStates: session.dragStates,
|
|
1942
|
+
lastValues: session.lastValues,
|
|
1943
|
+
});
|
|
1944
|
+
if (changes.length === 0) {
|
|
1945
|
+
clearSelectedOutlineDragOverrides({
|
|
1946
|
+
clearDragOverrides,
|
|
1947
|
+
dragStates: session.dragStates,
|
|
1948
|
+
});
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
1952
|
+
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
1953
|
+
Promise.all([
|
|
1954
|
+
staticChanges.length > 0
|
|
1955
|
+
? (0, save_sequence_prop_1.saveSequenceProps)({
|
|
1956
|
+
changes: staticChanges,
|
|
1957
|
+
setPropStatuses,
|
|
1958
|
+
clientId: session.clientId,
|
|
1959
|
+
undoLabel: changes.length > 1 ? 'Move selected sequences' : 'Move sequence',
|
|
1960
|
+
redoLabel: changes.length > 1
|
|
1961
|
+
? 'Move selected sequences back'
|
|
1962
|
+
: 'Move sequence back',
|
|
1963
|
+
})
|
|
1964
|
+
: Promise.resolve(),
|
|
1965
|
+
...keyframedChanges.map((change) => (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
1966
|
+
fileName: change.fileName,
|
|
1967
|
+
nodePath: change.nodePath,
|
|
1968
|
+
fieldKey: change.fieldKey,
|
|
1969
|
+
sourceFrame: change.sourceFrame,
|
|
1970
|
+
value: change.value,
|
|
1971
|
+
schema: change.schema,
|
|
1972
|
+
setPropStatuses,
|
|
1973
|
+
clientId: change.clientId,
|
|
1974
|
+
})),
|
|
1975
|
+
])
|
|
1976
|
+
.catch((err) => {
|
|
1977
|
+
(0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
1978
|
+
})
|
|
1979
|
+
.finally(() => {
|
|
1980
|
+
clearSelectedOutlineDragOverrides({
|
|
1981
|
+
clearDragOverrides,
|
|
1982
|
+
dragStates: session.dragStates,
|
|
1983
|
+
});
|
|
1984
|
+
});
|
|
1985
|
+
}, [clearDragOverrides, setPropStatuses]);
|
|
1986
|
+
(0, react_1.useEffect)(() => {
|
|
1987
|
+
saveKeyboardNudgeSessionRef.current = saveKeyboardNudgeSession;
|
|
1988
|
+
}, [saveKeyboardNudgeSession]);
|
|
1989
|
+
(0, react_1.useEffect)(() => {
|
|
1990
|
+
return () => {
|
|
1991
|
+
saveKeyboardNudgeSessionRef.current();
|
|
1992
|
+
};
|
|
1993
|
+
}, []);
|
|
1994
|
+
const seekWithArrowKey = (0, react_1.useCallback)((event, direction) => {
|
|
1995
|
+
if (direction === 'up' || direction === 'down') {
|
|
1996
|
+
return;
|
|
1997
|
+
}
|
|
1998
|
+
event.preventDefault();
|
|
1999
|
+
if (direction === 'left') {
|
|
2000
|
+
if (event.altKey) {
|
|
2001
|
+
seek(0);
|
|
2002
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2003
|
+
direction: 'fit-left',
|
|
2004
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
2005
|
+
frame: 0,
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
else if (event.shiftKey) {
|
|
2009
|
+
frameBack((0, imperative_state_1.getCurrentFps)());
|
|
2010
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2011
|
+
direction: 'fit-left',
|
|
2012
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
2013
|
+
frame: Math.max(0, getCurrentFrame() - (0, imperative_state_1.getCurrentFps)()),
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
else {
|
|
2017
|
+
frameBack(1);
|
|
2018
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2019
|
+
direction: 'fit-left',
|
|
2020
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
2021
|
+
frame: Math.max(0, getCurrentFrame() - 1),
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
if (event.altKey) {
|
|
2027
|
+
seek((0, imperative_state_1.getCurrentDuration)() - 1);
|
|
2028
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2029
|
+
direction: 'fit-right',
|
|
2030
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
2031
|
+
frame: (0, imperative_state_1.getCurrentDuration)() - 1,
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
else if (event.shiftKey) {
|
|
2035
|
+
frameForward((0, imperative_state_1.getCurrentFps)());
|
|
2036
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2037
|
+
direction: 'fit-right',
|
|
2038
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
2039
|
+
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + (0, imperative_state_1.getCurrentFps)()),
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
else {
|
|
2043
|
+
frameForward(1);
|
|
2044
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
2045
|
+
direction: 'fit-right',
|
|
2046
|
+
durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
2047
|
+
frame: Math.min((0, imperative_state_1.getCurrentDuration)() - 1, getCurrentFrame() + 1),
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
}, [frameBack, frameForward, getCurrentFrame, seek]);
|
|
2051
|
+
const onArrowKeyDown = (0, react_1.useCallback)((event) => {
|
|
2052
|
+
var _a;
|
|
2053
|
+
const direction = getSelectedOutlineKeyboardNudgeDirection(event.key);
|
|
2054
|
+
if (direction === null) {
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
if (selectedItems.length === 0 || allDragTargets.length === 0) {
|
|
2058
|
+
seekWithArrowKey(event, direction);
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
if (event.altKey) {
|
|
2062
|
+
seekWithArrowKey(event, direction);
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2065
|
+
event.preventDefault();
|
|
2066
|
+
const activeSession = (_a = keyboardNudgeSessionRef.current) !== null && _a !== void 0 ? _a : (() => {
|
|
2067
|
+
const [firstDragTarget] = allDragTargets;
|
|
2068
|
+
if (firstDragTarget === undefined) {
|
|
2069
|
+
throw new Error('Expected a drag target');
|
|
2070
|
+
}
|
|
2071
|
+
return {
|
|
2072
|
+
clientId: firstDragTarget.clientId,
|
|
2073
|
+
deltaX: 0,
|
|
2074
|
+
deltaY: 0,
|
|
2075
|
+
dragStates: getSelectedOutlineDragStates({
|
|
2076
|
+
dragTargets: allDragTargets,
|
|
2077
|
+
getDragOverrides,
|
|
2078
|
+
timelinePosition,
|
|
2079
|
+
}),
|
|
2080
|
+
lastValues: new Map(),
|
|
2081
|
+
};
|
|
2082
|
+
})();
|
|
2083
|
+
keyboardNudgeSessionRef.current = activeSession;
|
|
2084
|
+
const nextDeltas = (0, exports.getSelectedOutlineKeyboardNudgeDeltas)({
|
|
2085
|
+
deltaX: activeSession.deltaX,
|
|
2086
|
+
deltaY: activeSession.deltaY,
|
|
2087
|
+
direction,
|
|
2088
|
+
shiftKey: event.shiftKey,
|
|
2089
|
+
});
|
|
2090
|
+
activeSession.deltaX = nextDeltas.deltaX;
|
|
2091
|
+
activeSession.deltaY = nextDeltas.deltaY;
|
|
2092
|
+
const lastValues = (0, exports.getSelectedOutlineDragValues)({
|
|
2093
|
+
dragStates: activeSession.dragStates,
|
|
2094
|
+
deltaX: activeSession.deltaX,
|
|
2095
|
+
deltaY: activeSession.deltaY,
|
|
2096
|
+
});
|
|
2097
|
+
activeSession.lastValues = lastValues;
|
|
2098
|
+
for (const dragState of activeSession.dragStates) {
|
|
2099
|
+
const value = lastValues.get(dragState.key);
|
|
2100
|
+
if (value === undefined) {
|
|
2101
|
+
throw new Error('Expected drag value to be available');
|
|
2102
|
+
}
|
|
2103
|
+
if (dragState.target.propStatus.status === 'keyframed') {
|
|
2104
|
+
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeKeyframedDragOverride({
|
|
2105
|
+
status: dragState.target.propStatus,
|
|
2106
|
+
frame: dragState.sourceFrame,
|
|
2107
|
+
value,
|
|
2108
|
+
}));
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
setDragOverrides(dragState.target.nodePath, translateFieldKey, remotion_1.Internals.makeStaticDragOverride(value));
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
}, [
|
|
2115
|
+
allDragTargets,
|
|
2116
|
+
getDragOverrides,
|
|
2117
|
+
seekWithArrowKey,
|
|
2118
|
+
selectedItems.length,
|
|
2119
|
+
setDragOverrides,
|
|
2120
|
+
timelinePosition,
|
|
2121
|
+
]);
|
|
2122
|
+
const onArrowKeyUp = (0, react_1.useCallback)((event) => {
|
|
2123
|
+
const direction = getSelectedOutlineKeyboardNudgeDirection(event.key);
|
|
2124
|
+
if (direction === null || keyboardNudgeSessionRef.current === null) {
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
event.preventDefault();
|
|
2128
|
+
saveKeyboardNudgeSession();
|
|
2129
|
+
}, [saveKeyboardNudgeSession]);
|
|
2130
|
+
(0, react_1.useEffect)(() => {
|
|
2131
|
+
const keyDownBindings = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].map((key) => keybindings.registerKeybinding({
|
|
2132
|
+
event: 'keydown',
|
|
2133
|
+
key,
|
|
2134
|
+
callback: onArrowKeyDown,
|
|
2135
|
+
commandCtrlKey: false,
|
|
2136
|
+
preventDefault: false,
|
|
2137
|
+
triggerIfInputFieldFocused: false,
|
|
2138
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
2139
|
+
}));
|
|
2140
|
+
const keyUpBindings = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].map((key) => keybindings.registerKeybinding({
|
|
2141
|
+
event: 'keyup',
|
|
2142
|
+
key,
|
|
2143
|
+
callback: onArrowKeyUp,
|
|
2144
|
+
commandCtrlKey: false,
|
|
2145
|
+
preventDefault: false,
|
|
2146
|
+
triggerIfInputFieldFocused: false,
|
|
2147
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
2148
|
+
}));
|
|
2149
|
+
return () => {
|
|
2150
|
+
for (const binding of [...keyDownBindings, ...keyUpBindings]) {
|
|
2151
|
+
binding.unregister();
|
|
2152
|
+
}
|
|
2153
|
+
};
|
|
2154
|
+
}, [keybindings, onArrowKeyDown, onArrowKeyUp, saveKeyboardNudgeSession]);
|
|
1213
2155
|
(0, react_1.useEffect)(() => {
|
|
1214
2156
|
if (outlineTargets.length === 0) {
|
|
1215
2157
|
setOutlines((prevOutlines) => prevOutlines.length === 0 ? prevOutlines : []);
|
|
@@ -1235,6 +2177,6 @@ const SelectedOutlineOverlay = ({ scale }) => {
|
|
|
1235
2177
|
if (outlineTargets.length === 0) {
|
|
1236
2178
|
return null;
|
|
1237
2179
|
}
|
|
1238
|
-
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, 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(SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
|
|
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`)))] }));
|
|
1239
2181
|
};
|
|
1240
2182
|
exports.SelectedOutlineOverlay = SelectedOutlineOverlay;
|