@remotion/studio 4.0.477 → 4.0.478
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CanvasIfSizeIsAvailable.js +2 -6
- package/dist/components/EditorGuides/Guide.js +37 -9
- package/dist/components/EditorRuler/Ruler.js +4 -14
- package/dist/components/EditorRuler/index.js +9 -4
- package/dist/components/InlineAction.js +1 -0
- package/dist/components/MenuToolbar.d.ts +1 -0
- package/dist/components/MenuToolbar.js +4 -1
- package/dist/components/SelectedOutlineElement.js +85 -14
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +5 -1
- package/dist/components/Timeline/TimelineSequence.js +7 -15
- package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
- package/dist/components/Timeline/TimelineVideoInfo.js +93 -8
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +7 -0
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +32 -3
- package/dist/components/Timeline/timeline-video-filmstrip-times.d.ts +17 -0
- package/dist/components/Timeline/timeline-video-filmstrip-times.js +22 -0
- package/dist/components/import-assets.d.ts +11 -2
- package/dist/components/import-assets.js +61 -6
- package/dist/components/selected-outline-drag.d.ts +23 -0
- package/dist/components/selected-outline-drag.js +49 -1
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -0
- package/dist/esm/{chunk-t8fjnw2d.js → chunk-hrw9799x.js} +926 -578
- package/dist/esm/internals.mjs +926 -578
- package/dist/esm/previewEntry.mjs +10204 -9852
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/editor-guide-selection.js +1 -1
- package/dist/helpers/get-preview-file-type.js +1 -1
- package/dist/helpers/ruler-canvas-size.d.ts +5 -0
- package/dist/helpers/ruler-canvas-size.js +17 -0
- package/package.json +11 -11
|
@@ -4,7 +4,7 @@ exports.CanvasIfSizeIsAvailable = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
7
|
+
const ruler_canvas_size_1 = require("../helpers/ruler-canvas-size");
|
|
8
8
|
const CanvasOrLoading_1 = require("./CanvasOrLoading");
|
|
9
9
|
const use_is_ruler_visible_1 = require("./EditorRuler/use-is-ruler-visible");
|
|
10
10
|
const CanvasIfSizeIsAvailable = () => {
|
|
@@ -18,11 +18,7 @@ const CanvasIfSizeIsAvailable = () => {
|
|
|
18
18
|
if (!size) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
return {
|
|
22
|
-
...size,
|
|
23
|
-
width: size.width - editor_rulers_1.RULER_WIDTH,
|
|
24
|
-
height: size.height - editor_rulers_1.RULER_WIDTH,
|
|
25
|
-
};
|
|
21
|
+
return (0, ruler_canvas_size_1.applyRulerInsetsToCanvasSize)({ rulersAreVisible, size });
|
|
26
22
|
}, [context, rulersAreVisible]);
|
|
27
23
|
if (!sizeWithRulersApplied) {
|
|
28
24
|
return null;
|
|
@@ -73,8 +73,7 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
73
73
|
clientX: e.clientX,
|
|
74
74
|
clientY: e.clientY,
|
|
75
75
|
};
|
|
76
|
-
shouldCreateGuideRef.current =
|
|
77
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)('no-drop');
|
|
76
|
+
shouldCreateGuideRef.current = false;
|
|
78
77
|
setDraggingGuideId(() => guide.id);
|
|
79
78
|
}, [guide.id, setDraggingGuideId, shouldCreateGuideRef]);
|
|
80
79
|
const onMouseDown = (0, react_1.useCallback)((e) => {
|
|
@@ -89,8 +88,7 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
89
88
|
clientX: e.clientX,
|
|
90
89
|
clientY: e.clientY,
|
|
91
90
|
};
|
|
92
|
-
shouldCreateGuideRef.current =
|
|
93
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)('no-drop');
|
|
91
|
+
shouldCreateGuideRef.current = false;
|
|
94
92
|
setDraggingGuideId(() => guide.id);
|
|
95
93
|
}, [guide.id, setDraggingGuideId, shouldCreateGuideRef]);
|
|
96
94
|
const updateHasMovedGuide = (0, react_1.useCallback)((clientX, clientY) => {
|
|
@@ -113,13 +111,40 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
113
111
|
const onMouseMove = (0, react_1.useCallback)((e) => {
|
|
114
112
|
updateHasMovedGuide(e.clientX, e.clientY);
|
|
115
113
|
}, [updateHasMovedGuide]);
|
|
114
|
+
const finishGuideInteraction = (0, react_1.useCallback)(() => {
|
|
115
|
+
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
116
|
+
setGuidesList((prevState) => {
|
|
117
|
+
const newGuides = shouldDeleteGuide
|
|
118
|
+
? prevState.filter((candidate) => candidate.id !== guide.id)
|
|
119
|
+
: prevState;
|
|
120
|
+
(0, editor_guides_1.persistGuidesList)(newGuides);
|
|
121
|
+
return newGuides;
|
|
122
|
+
});
|
|
123
|
+
if (shouldDeleteGuide && selected) {
|
|
124
|
+
clearSelection();
|
|
125
|
+
}
|
|
126
|
+
shouldDeleteGuideRef.current = false;
|
|
127
|
+
shouldCreateGuideRef.current = false;
|
|
128
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
129
|
+
setDraggingGuideId(() => null);
|
|
130
|
+
}, [
|
|
131
|
+
clearSelection,
|
|
132
|
+
guide.id,
|
|
133
|
+
selected,
|
|
134
|
+
setDraggingGuideId,
|
|
135
|
+
setGuidesList,
|
|
136
|
+
shouldCreateGuideRef,
|
|
137
|
+
shouldDeleteGuideRef,
|
|
138
|
+
]);
|
|
116
139
|
const onPointerUp = (0, react_1.useCallback)((e) => {
|
|
117
140
|
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
118
141
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
119
142
|
}
|
|
120
143
|
const pointerDownPosition = pointerDownPositionRef.current;
|
|
121
144
|
pointerDownPositionRef.current = null;
|
|
122
|
-
|
|
145
|
+
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
146
|
+
finishGuideInteraction();
|
|
147
|
+
if (shouldDeleteGuide) {
|
|
123
148
|
return;
|
|
124
149
|
}
|
|
125
150
|
if ((0, editor_guide_selection_1.isGuidePointerUpAClick)({
|
|
@@ -130,11 +155,13 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
130
155
|
})) {
|
|
131
156
|
onSelect();
|
|
132
157
|
}
|
|
133
|
-
}, [guide.id, onSelect, shouldDeleteGuideRef]);
|
|
158
|
+
}, [finishGuideInteraction, guide.id, onSelect, shouldDeleteGuideRef]);
|
|
134
159
|
const onMouseUp = (0, react_1.useCallback)((e) => {
|
|
135
160
|
const pointerDownPosition = pointerDownPositionRef.current;
|
|
136
161
|
pointerDownPositionRef.current = null;
|
|
137
|
-
|
|
162
|
+
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
163
|
+
finishGuideInteraction();
|
|
164
|
+
if (shouldDeleteGuide) {
|
|
138
165
|
return;
|
|
139
166
|
}
|
|
140
167
|
if ((0, editor_guide_selection_1.isGuidePointerUpAClick)({
|
|
@@ -145,7 +172,7 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
145
172
|
})) {
|
|
146
173
|
onSelect();
|
|
147
174
|
}
|
|
148
|
-
}, [guide.id, onSelect, shouldDeleteGuideRef]);
|
|
175
|
+
}, [finishGuideInteraction, guide.id, onSelect, shouldDeleteGuideRef]);
|
|
149
176
|
const onClick = (0, react_1.useCallback)((e) => {
|
|
150
177
|
if (e.button !== 0) {
|
|
151
178
|
return;
|
|
@@ -155,7 +182,8 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
155
182
|
}, []);
|
|
156
183
|
const onPointerCancel = (0, react_1.useCallback)(() => {
|
|
157
184
|
pointerDownPositionRef.current = null;
|
|
158
|
-
|
|
185
|
+
finishGuideInteraction();
|
|
186
|
+
}, [finishGuideInteraction]);
|
|
159
187
|
const isActive = selected || hoveredGuideId === guide.id;
|
|
160
188
|
const activeClassName = isActive ? '__remotion_editor_guide_selected' : null;
|
|
161
189
|
const guideClassName = (0, react_1.useMemo)(() => {
|
|
@@ -23,7 +23,7 @@ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, o
|
|
|
23
23
|
if (!unsafeVideoConfig) {
|
|
24
24
|
throw new Error('Video config not set');
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const cursor = isVerticalRuler ? 'ew-resize' : 'ns-resize';
|
|
27
27
|
const guideHighlight = (0, react_1.useMemo)(() => (0, editor_guide_selection_1.getRulerGuideHighlight)({
|
|
28
28
|
guidesList,
|
|
29
29
|
selectedItems,
|
|
@@ -76,7 +76,7 @@ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, o
|
|
|
76
76
|
// Prevent deselection of currently selected items
|
|
77
77
|
e.stopPropagation();
|
|
78
78
|
shouldCreateGuideRef.current = true;
|
|
79
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(
|
|
79
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(cursor);
|
|
80
80
|
const guideId = makeGuideId();
|
|
81
81
|
setEditorShowGuides(() => true);
|
|
82
82
|
setDraggingGuideId(() => guideId);
|
|
@@ -100,18 +100,8 @@ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, o
|
|
|
100
100
|
orientation,
|
|
101
101
|
originOffset,
|
|
102
102
|
unsafeVideoConfig.id,
|
|
103
|
+
cursor,
|
|
103
104
|
]);
|
|
104
|
-
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
if (draggingGuideId !== null) {
|
|
107
|
-
setCursor('no-drop');
|
|
108
|
-
}
|
|
109
|
-
}, [setCursor, draggingGuideId]);
|
|
110
|
-
(0, react_1.useEffect)(() => {
|
|
111
|
-
if (draggingGuideId === null) {
|
|
112
|
-
setCursor(isVerticalRuler ? 'ew-resize' : 'ns-resize');
|
|
113
|
-
}
|
|
114
|
-
}, [draggingGuideId, isVerticalRuler]);
|
|
115
|
-
return (jsx_runtime_1.jsx("canvas", { ref: rulerCanvasRef, width: rulerWidth * window.devicePixelRatio, height: rulerHeight * window.devicePixelRatio, style: rulerStyle, [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', onPointerDown: onPointerDown, onPointerEnter: changeCursor, onPointerLeave: changeCursor }));
|
|
105
|
+
return (jsx_runtime_1.jsx("canvas", { ref: rulerCanvasRef, width: rulerWidth * window.devicePixelRatio, height: rulerHeight * window.devicePixelRatio, style: rulerStyle, [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', onPointerDown: onPointerDown }));
|
|
116
106
|
};
|
|
117
107
|
exports.default = Ruler;
|
|
@@ -73,12 +73,13 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
73
73
|
if (!shouldDeleteGuideRef.current) {
|
|
74
74
|
shouldDeleteGuideRef.current = true;
|
|
75
75
|
}
|
|
76
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)('no-drop');
|
|
77
76
|
setGuidesList((prevState) => {
|
|
78
77
|
const newGuides = prevState.map((guide) => {
|
|
79
78
|
if (guide.id !== draggingGuideId) {
|
|
80
79
|
return guide;
|
|
81
80
|
}
|
|
81
|
+
const desiredCursor = guide.orientation === 'vertical' ? 'ew-resize' : 'ns-resize';
|
|
82
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(desiredCursor);
|
|
82
83
|
return {
|
|
83
84
|
...guide,
|
|
84
85
|
show: false,
|
|
@@ -124,9 +125,10 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
124
125
|
canvasPosition.top,
|
|
125
126
|
]);
|
|
126
127
|
const onMouseUp = (0, react_1.useCallback)(() => {
|
|
128
|
+
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
127
129
|
setGuidesList((prevState) => {
|
|
128
130
|
const newGuides = prevState.filter((selected) => {
|
|
129
|
-
if (!
|
|
131
|
+
if (!shouldDeleteGuide) {
|
|
130
132
|
return true;
|
|
131
133
|
}
|
|
132
134
|
return selected.id !== draggingGuideId;
|
|
@@ -135,7 +137,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
135
137
|
return newGuides;
|
|
136
138
|
});
|
|
137
139
|
const deletedGuideWasSelected = selectedItems.some((item) => item.type === 'guide' && item.guideId === draggingGuideId);
|
|
138
|
-
if (
|
|
140
|
+
if (shouldDeleteGuide && deletedGuideWasSelected) {
|
|
139
141
|
clearSelection();
|
|
140
142
|
}
|
|
141
143
|
shouldDeleteGuideRef.current = false;
|
|
@@ -143,6 +145,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
143
145
|
shouldCreateGuideRef.current = false;
|
|
144
146
|
setDraggingGuideId(() => null);
|
|
145
147
|
document.removeEventListener('pointerup', onMouseUp);
|
|
148
|
+
document.removeEventListener('pointercancel', onMouseUp);
|
|
146
149
|
document.removeEventListener('pointermove', onMouseMove);
|
|
147
150
|
}, [
|
|
148
151
|
clearSelection,
|
|
@@ -154,14 +157,16 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
154
157
|
onMouseMove,
|
|
155
158
|
selectedItems,
|
|
156
159
|
]);
|
|
157
|
-
(0, react_1.
|
|
160
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
158
161
|
if (draggingGuideId !== null) {
|
|
159
162
|
document.addEventListener('pointermove', onMouseMove);
|
|
160
163
|
document.addEventListener('pointerup', onMouseUp);
|
|
164
|
+
document.addEventListener('pointercancel', onMouseUp);
|
|
161
165
|
}
|
|
162
166
|
return () => {
|
|
163
167
|
document.removeEventListener('pointermove', onMouseMove);
|
|
164
168
|
document.removeEventListener('pointerup', onMouseUp);
|
|
169
|
+
document.removeEventListener('pointercancel', onMouseUp);
|
|
165
170
|
if (requestAnimationFrameRef.current) {
|
|
166
171
|
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
167
172
|
}
|
|
@@ -22,6 +22,7 @@ const InlineAction = ({ renderAction, onClick, disabled, title, }) => {
|
|
|
22
22
|
: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected: false }),
|
|
23
23
|
height: 24,
|
|
24
24
|
width: 24,
|
|
25
|
+
padding: 0,
|
|
25
26
|
display: 'inline-flex',
|
|
26
27
|
justifyContent: 'center',
|
|
27
28
|
alignItems: 'center',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MenuToolbar = void 0;
|
|
3
|
+
exports.MenuToolbar = exports.MENU_TOOLBAR_HEIGHT = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
@@ -12,13 +12,16 @@ const MenuBuildIndicator_1 = require("./MenuBuildIndicator");
|
|
|
12
12
|
const SidebarCollapserControls_1 = require("./SidebarCollapserControls");
|
|
13
13
|
const UndoRedoButtons_1 = require("./UndoRedoButtons");
|
|
14
14
|
const UpdateCheck_1 = require("./UpdateCheck");
|
|
15
|
+
exports.MENU_TOOLBAR_HEIGHT = 30;
|
|
15
16
|
const row = {
|
|
16
17
|
alignItems: 'center',
|
|
17
18
|
flexDirection: 'row',
|
|
18
19
|
display: 'flex',
|
|
19
20
|
color: 'white',
|
|
20
21
|
borderBottom: '1px solid black',
|
|
22
|
+
boxSizing: 'border-box',
|
|
21
23
|
fontSize: 13,
|
|
24
|
+
height: exports.MENU_TOOLBAR_HEIGHT,
|
|
22
25
|
paddingLeft: 6,
|
|
23
26
|
paddingRight: 10,
|
|
24
27
|
backgroundColor: colors_1.BACKGROUND,
|
|
@@ -113,14 +113,41 @@ const SelectedOutlineTransformOriginHandle = ({ outline, onDraggingChange, targe
|
|
|
113
113
|
? JSON.stringify(transformOriginDrag.translateDefault)
|
|
114
114
|
: null;
|
|
115
115
|
let last = null;
|
|
116
|
+
let currentPointerX = event.clientX;
|
|
117
|
+
let currentPointerY = event.clientY;
|
|
118
|
+
let axisLocked = event.shiftKey;
|
|
116
119
|
onDraggingChange(true);
|
|
117
120
|
(0, ForceSpecificCursor_1.forceSpecificCursor)('crosshair');
|
|
118
|
-
const
|
|
121
|
+
const updateFromPointerPosition = () => {
|
|
119
122
|
const point = {
|
|
120
|
-
x:
|
|
121
|
-
y:
|
|
123
|
+
x: currentPointerX - svgRect.left,
|
|
124
|
+
y: currentPointerY - svgRect.top,
|
|
122
125
|
};
|
|
123
|
-
const
|
|
126
|
+
const rawUv = (0, selected_outline_uv_1.getUvCoordinateForPoint)(outline.points, point);
|
|
127
|
+
const lockedAxis = (0, selected_outline_drag_1.getSelectedOutlineTransformOriginLockedAxis)({
|
|
128
|
+
axisLocked,
|
|
129
|
+
dimensions,
|
|
130
|
+
startUv: uv,
|
|
131
|
+
uv: rawUv,
|
|
132
|
+
});
|
|
133
|
+
const axisLockedUv = (0, selected_outline_drag_1.applySelectedOutlineTransformOriginAxisLock)({
|
|
134
|
+
lockedAxis,
|
|
135
|
+
startUv: uv,
|
|
136
|
+
uv: rawUv,
|
|
137
|
+
});
|
|
138
|
+
const snapPoint = lockedAxis === null
|
|
139
|
+
? point
|
|
140
|
+
: (0, selected_outline_uv_1.getUvHandlePosition)(outline.points, axisLockedUv);
|
|
141
|
+
const snappedUv = (0, selected_outline_drag_1.snapSelectedOutlineTransformOriginUv)({
|
|
142
|
+
point: snapPoint,
|
|
143
|
+
points: outline.points,
|
|
144
|
+
uv: axisLockedUv,
|
|
145
|
+
});
|
|
146
|
+
const nextUv = (0, selected_outline_drag_1.applySelectedOutlineTransformOriginAxisLock)({
|
|
147
|
+
lockedAxis,
|
|
148
|
+
startUv: uv,
|
|
149
|
+
uv: snappedUv,
|
|
150
|
+
});
|
|
124
151
|
const deltaOrigin = [
|
|
125
152
|
(nextUv[0] - uv[0]) * dimensions.width,
|
|
126
153
|
(nextUv[1] - uv[1]) * dimensions.height,
|
|
@@ -152,15 +179,31 @@ const SelectedOutlineTransformOriginHandle = ({ outline, onDraggingChange, targe
|
|
|
152
179
|
})
|
|
153
180
|
: remotion_1.Internals.makeStaticDragOverride(translate));
|
|
154
181
|
};
|
|
155
|
-
|
|
182
|
+
updateFromPointerPosition();
|
|
156
183
|
const onPointerMove = (moveEvent) => {
|
|
157
184
|
moveEvent.preventDefault();
|
|
158
|
-
|
|
185
|
+
currentPointerX = moveEvent.clientX;
|
|
186
|
+
currentPointerY = moveEvent.clientY;
|
|
187
|
+
axisLocked = moveEvent.shiftKey;
|
|
188
|
+
updateFromPointerPosition();
|
|
189
|
+
};
|
|
190
|
+
const onKeyChange = (keyEvent) => {
|
|
191
|
+
if (keyEvent.key !== 'Shift') {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const nextAxisLocked = keyEvent.type === 'keydown';
|
|
195
|
+
if (nextAxisLocked === axisLocked) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
axisLocked = nextAxisLocked;
|
|
199
|
+
updateFromPointerPosition();
|
|
159
200
|
};
|
|
160
201
|
const onPointerUp = () => {
|
|
161
202
|
window.removeEventListener('pointermove', onPointerMove);
|
|
162
203
|
window.removeEventListener('pointerup', onPointerUp);
|
|
163
204
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
205
|
+
window.removeEventListener('keydown', onKeyChange);
|
|
206
|
+
window.removeEventListener('keyup', onKeyChange);
|
|
164
207
|
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
165
208
|
onDraggingChange(false);
|
|
166
209
|
if (last === null || (0, selected_outline_drag_1.uvsEqual)(last.uv, uv)) {
|
|
@@ -242,6 +285,8 @@ const SelectedOutlineTransformOriginHandle = ({ outline, onDraggingChange, targe
|
|
|
242
285
|
window.addEventListener('pointermove', onPointerMove);
|
|
243
286
|
window.addEventListener('pointerup', onPointerUp);
|
|
244
287
|
window.addEventListener('pointercancel', onPointerUp);
|
|
288
|
+
window.addEventListener('keydown', onKeyChange);
|
|
289
|
+
window.addEventListener('keyup', onKeyChange);
|
|
245
290
|
}, [
|
|
246
291
|
clearDragOverrides,
|
|
247
292
|
onDraggingChange,
|
|
@@ -506,8 +551,6 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
506
551
|
if (interaction.shiftKey || interaction.toggleKey) {
|
|
507
552
|
return;
|
|
508
553
|
}
|
|
509
|
-
onDraggingChange(true);
|
|
510
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(edgeInfo.cursor);
|
|
511
554
|
const startPointer = { x: event.clientX, y: event.clientY };
|
|
512
555
|
const dragStates = (0, selected_outline_drag_1.getSelectedOutlineScaleDragStates)({
|
|
513
556
|
dragTargets: selected ? allScaleDragTargets : [scaleDrag],
|
|
@@ -515,12 +558,24 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
515
558
|
timelinePosition: timelinePositionRef.current,
|
|
516
559
|
});
|
|
517
560
|
let lastValues = new Map();
|
|
561
|
+
let dragStarted = false;
|
|
518
562
|
const onPointerMove = (moveEvent) => {
|
|
519
563
|
moveEvent.preventDefault();
|
|
520
564
|
const delta = {
|
|
521
565
|
x: moveEvent.clientX - startPointer.x,
|
|
522
566
|
y: moveEvent.clientY - startPointer.y,
|
|
523
567
|
};
|
|
568
|
+
if (!dragStarted) {
|
|
569
|
+
if (!(0, selected_outline_drag_1.isSelectedOutlineDragPastThreshold)({
|
|
570
|
+
deltaX: delta.x,
|
|
571
|
+
deltaY: delta.y,
|
|
572
|
+
})) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
dragStarted = true;
|
|
576
|
+
onDraggingChange(true);
|
|
577
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(edgeInfo.cursor);
|
|
578
|
+
}
|
|
524
579
|
const projectedDelta = (0, selected_outline_measurement_1.dot)(delta, edgeInfo.normal);
|
|
525
580
|
const scaleFactor = Math.max(0.001, 1 + projectedDelta / edgeInfo.extent);
|
|
526
581
|
lastValues = (0, selected_outline_drag_1.getSelectedOutlineScaleDragValues)({
|
|
@@ -549,8 +604,10 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues,
|
|
|
549
604
|
window.removeEventListener('pointermove', onPointerMove);
|
|
550
605
|
window.removeEventListener('pointerup', onPointerUp);
|
|
551
606
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
552
|
-
|
|
553
|
-
|
|
607
|
+
if (dragStarted) {
|
|
608
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
609
|
+
onDraggingChange(false);
|
|
610
|
+
}
|
|
554
611
|
const changes = (0, selected_outline_drag_1.getSelectedOutlineScaleDragChanges)({
|
|
555
612
|
dragStates,
|
|
556
613
|
lastValues,
|
|
@@ -665,8 +722,7 @@ const SelectedOutlineRotationCornerHandle = ({ allRotationDragTargets, contextMe
|
|
|
665
722
|
if (interaction.shiftKey || interaction.toggleKey) {
|
|
666
723
|
return;
|
|
667
724
|
}
|
|
668
|
-
|
|
669
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(cornerInfo.cursor);
|
|
725
|
+
const startPointer = { x: event.clientX, y: event.clientY };
|
|
670
726
|
const svgRect = svg.getBoundingClientRect();
|
|
671
727
|
const center = svgPointToClientPoint((0, selected_outline_measurement_1.getSelectedOutlineRotationPivot)({
|
|
672
728
|
dimensions: outline.dimensions,
|
|
@@ -684,8 +740,21 @@ const SelectedOutlineRotationCornerHandle = ({ allRotationDragTargets, contextMe
|
|
|
684
740
|
});
|
|
685
741
|
let accumulatedDelta = 0;
|
|
686
742
|
let lastValues = new Map();
|
|
743
|
+
let dragStarted = false;
|
|
687
744
|
const onPointerMove = (moveEvent) => {
|
|
688
745
|
moveEvent.preventDefault();
|
|
746
|
+
const screenDeltaX = moveEvent.clientX - startPointer.x;
|
|
747
|
+
const screenDeltaY = moveEvent.clientY - startPointer.y;
|
|
748
|
+
if (!dragStarted) {
|
|
749
|
+
if (!(0, selected_outline_drag_1.isSelectedOutlineDragPastThreshold)({
|
|
750
|
+
deltaX: screenDeltaX,
|
|
751
|
+
deltaY: screenDeltaY,
|
|
752
|
+
})) {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
dragStarted = true;
|
|
756
|
+
onDraggingChange(true);
|
|
757
|
+
}
|
|
689
758
|
const nextAngle = (0, selected_outline_measurement_1.getAngleDegrees)(center, {
|
|
690
759
|
x: moveEvent.clientX,
|
|
691
760
|
y: moveEvent.clientY,
|
|
@@ -721,8 +790,10 @@ const SelectedOutlineRotationCornerHandle = ({ allRotationDragTargets, contextMe
|
|
|
721
790
|
window.removeEventListener('pointermove', onPointerMove);
|
|
722
791
|
window.removeEventListener('pointerup', onPointerUp);
|
|
723
792
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
724
|
-
|
|
725
|
-
|
|
793
|
+
if (dragStarted) {
|
|
794
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
795
|
+
onDraggingChange(false);
|
|
796
|
+
}
|
|
726
797
|
const changes = (0, selected_outline_drag_1.getSelectedOutlineRotationDragChanges)({
|
|
727
798
|
dragStates,
|
|
728
799
|
lastValues,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export { applySelectedOutlineDragAxisLock, compensateTranslateForTransformOrigin, getSelectedOutlineDragChanges, getSelectedOutlineDragValues, getSelectedOutlineKeyboardNudgeDelta, getSelectedOutlineKeyboardNudgeDeltas, getSelectedOutlineRotationDragChanges, getSelectedOutlineRotationDragStates, getSelectedOutlineRotationDragValues, getSelectedOutlineScaleDragChanges, getSelectedOutlineScaleDragStates, getSelectedOutlineScaleDragValues, getSelectedOutlineScaleEdgeInfo, isSelectedOutlineDragPastThreshold, } from './selected-outline-drag';
|
|
2
|
+
export { applySelectedOutlineDragAxisLock, applySelectedOutlineTransformOriginAxisLock, compensateTranslateForTransformOrigin, getSelectedOutlineDragChanges, getSelectedOutlineDragValues, getSelectedOutlineKeyboardNudgeDelta, getSelectedOutlineKeyboardNudgeDeltas, getSelectedOutlineRotationDragChanges, getSelectedOutlineRotationDragStates, getSelectedOutlineRotationDragValues, getSelectedOutlineScaleDragChanges, getSelectedOutlineScaleDragStates, getSelectedOutlineScaleDragValues, getSelectedOutlineScaleEdgeInfo, getSelectedOutlineTransformOriginLockedAxis, isSelectedOutlineDragPastThreshold, selectedOutlineTransformOriginSnapThresholdPx, snapSelectedOutlineTransformOriginUv, } from './selected-outline-drag';
|
|
3
3
|
export { getOutlineSelectionInteraction, getSelectedEffectFieldsBySequenceKey, getSelectedOutlineRotationCornerInfo, getSelectedOutlineRotationDeltaDegrees, getSelectedOutlineRotationPivot, getSelectedSequenceKeys, getSequencesWithSelectableOutlines, getTransformedSvgViewportPoints, } from './selected-outline-measurement';
|
|
4
4
|
export { selectedOutlineDragThresholdPx } from './selected-outline-types';
|
|
5
5
|
export type { SelectedOutlineDragState, SelectedOutlineRotationDragState, SelectedOutlineScaleDragState, } from './selected-outline-types';
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SelectedOutlineOverlay = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineDragAxisLock = void 0;
|
|
36
|
+
exports.SelectedOutlineOverlay = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineTransformOriginLockedAxis = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineTransformOriginAxisLock = exports.applySelectedOutlineDragAxisLock = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const player_1 = require("@remotion/player");
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
@@ -57,6 +57,7 @@ const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
|
57
57
|
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
58
58
|
const selected_outline_drag_2 = require("./selected-outline-drag");
|
|
59
59
|
Object.defineProperty(exports, "applySelectedOutlineDragAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineDragAxisLock; } });
|
|
60
|
+
Object.defineProperty(exports, "applySelectedOutlineTransformOriginAxisLock", { enumerable: true, get: function () { return selected_outline_drag_2.applySelectedOutlineTransformOriginAxisLock; } });
|
|
60
61
|
Object.defineProperty(exports, "compensateTranslateForTransformOrigin", { enumerable: true, get: function () { return selected_outline_drag_2.compensateTranslateForTransformOrigin; } });
|
|
61
62
|
Object.defineProperty(exports, "getSelectedOutlineDragChanges", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineDragChanges; } });
|
|
62
63
|
Object.defineProperty(exports, "getSelectedOutlineDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineDragValues; } });
|
|
@@ -69,7 +70,10 @@ Object.defineProperty(exports, "getSelectedOutlineScaleDragChanges", { enumerabl
|
|
|
69
70
|
Object.defineProperty(exports, "getSelectedOutlineScaleDragStates", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleDragStates; } });
|
|
70
71
|
Object.defineProperty(exports, "getSelectedOutlineScaleDragValues", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleDragValues; } });
|
|
71
72
|
Object.defineProperty(exports, "getSelectedOutlineScaleEdgeInfo", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineScaleEdgeInfo; } });
|
|
73
|
+
Object.defineProperty(exports, "getSelectedOutlineTransformOriginLockedAxis", { enumerable: true, get: function () { return selected_outline_drag_2.getSelectedOutlineTransformOriginLockedAxis; } });
|
|
72
74
|
Object.defineProperty(exports, "isSelectedOutlineDragPastThreshold", { enumerable: true, get: function () { return selected_outline_drag_2.isSelectedOutlineDragPastThreshold; } });
|
|
75
|
+
Object.defineProperty(exports, "selectedOutlineTransformOriginSnapThresholdPx", { enumerable: true, get: function () { return selected_outline_drag_2.selectedOutlineTransformOriginSnapThresholdPx; } });
|
|
76
|
+
Object.defineProperty(exports, "snapSelectedOutlineTransformOriginUv", { enumerable: true, get: function () { return selected_outline_drag_2.snapSelectedOutlineTransformOriginUv; } });
|
|
73
77
|
const selected_outline_measurement_2 = require("./selected-outline-measurement");
|
|
74
78
|
Object.defineProperty(exports, "getOutlineSelectionInteraction", { enumerable: true, get: function () { return selected_outline_measurement_2.getOutlineSelectionInteraction; } });
|
|
75
79
|
Object.defineProperty(exports, "getSelectedEffectFieldsBySequenceKey", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedEffectFieldsBySequenceKey; } });
|
|
@@ -153,10 +153,10 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
153
153
|
// If a duration is 1, it is essentially a still and it should have width 0
|
|
154
154
|
// Some compositions may not be longer than their media duration,
|
|
155
155
|
// if that is the case, it needs to be asynchronously determined
|
|
156
|
-
var _a, _b
|
|
157
|
-
var _d, _e, _f
|
|
156
|
+
var _a, _b;
|
|
157
|
+
var _c, _d, _e, _f;
|
|
158
158
|
const video = remotion_1.Internals.useVideo();
|
|
159
|
-
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (
|
|
159
|
+
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (_c = video === null || video === void 0 ? void 0 : video.fps) !== null && _c !== void 0 ? _c : 30);
|
|
160
160
|
const effectiveMaxMediaDuration = s.loopDisplay ? null : maxMediaDuration;
|
|
161
161
|
const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(s.getStack);
|
|
162
162
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
@@ -173,7 +173,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
173
173
|
};
|
|
174
174
|
}, [originalLocation]);
|
|
175
175
|
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
176
|
-
const nodePath = (
|
|
176
|
+
const nodePath = (_d = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _d !== void 0 ? _d : null;
|
|
177
177
|
const propStatusesForOverride = (0, react_1.useMemo)(() => {
|
|
178
178
|
return nodePath
|
|
179
179
|
? remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)
|
|
@@ -320,19 +320,11 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
320
320
|
onSelect({ shiftKey: false, toggleKey: false });
|
|
321
321
|
}
|
|
322
322
|
}, [onSelect, selectable]);
|
|
323
|
-
const
|
|
324
|
-
const runtimeFreezeFrame = typeof ((_c = s.controls) === null || _c === void 0 ? void 0 : _c.currentRuntimeValueDotNotation.freeze) === 'number'
|
|
325
|
-
? s.controls.currentRuntimeValueDotNotation.freeze
|
|
326
|
-
: null;
|
|
327
|
-
const frozenFrame = (freezeStatus === null || freezeStatus === void 0 ? void 0 : freezeStatus.status) === 'static'
|
|
328
|
-
? typeof freezeStatus.codeValue === 'number'
|
|
329
|
-
? freezeStatus.codeValue
|
|
330
|
-
: null
|
|
331
|
-
: runtimeFreezeFrame;
|
|
323
|
+
const { frozenFrame } = s;
|
|
332
324
|
const { onPointerDown: onMoveDragPointerDown } = (0, TimelineSequenceRightEdgeDragHandle_1.useTimelineSequenceFromDrag)({
|
|
333
325
|
nodePathInfo,
|
|
334
326
|
windowWidth,
|
|
335
|
-
timelineDurationInFrames: (
|
|
327
|
+
timelineDurationInFrames: (_e = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _e !== void 0 ? _e : 1,
|
|
336
328
|
});
|
|
337
329
|
if (!video) {
|
|
338
330
|
throw new TypeError('Expected video config');
|
|
@@ -386,7 +378,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
386
378
|
if (maxMediaDuration === null && !s.loopDisplay) {
|
|
387
379
|
return null;
|
|
388
380
|
}
|
|
389
|
-
const sequence = (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset, fromCanUpdate: fromCanUpdate, frozenFrame: frozenFrame, onMoveDragPointerDown: onMoveDragPointerDown, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes })), showRightEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceRightEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (
|
|
381
|
+
const sequence = (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset, fromCanUpdate: fromCanUpdate, frozenFrame: frozenFrame, onMoveDragPointerDown: onMoveDragPointerDown, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay, frozenMediaFrame: s.frozenMediaFrame })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes })), showRightEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceRightEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (_f = video.durationInFrames) !== null && _f !== void 0 ? _f : 1 })) : null] }));
|
|
390
382
|
return previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: onContextMenuOpen, children: sequence })) : (sequence);
|
|
391
383
|
};
|
|
392
384
|
exports.TimelineSequence = react_1.default.memo(TimelineSequenceFn);
|