@remotion/studio 4.0.519 → 4.0.520
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/api/visual-control.js +2 -2
- package/dist/components/AudioWaveform.js +6 -1
- package/dist/components/Canvas.js +30 -36
- package/dist/components/CompositionSelector.js +6 -10
- package/dist/components/CompositionSelectorItem.js +7 -12
- package/dist/components/CurrentCompositionSideEffects.js +5 -0
- package/dist/components/ElementInstallConfirmation.d.ts +2 -23
- package/dist/components/ElementInstallConfirmation.js +16 -2
- package/dist/components/FpsCounter.js +1 -1
- package/dist/components/FramePersistor.js +1 -1
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -3
- package/dist/components/InspectorPanel/use-composition-actions.js +5 -8
- package/dist/components/Modals.js +1 -1
- package/dist/components/NewComposition/NewComposition.js +2 -2
- package/dist/components/PlayPause.js +2 -13
- package/dist/components/PreviewToolbar.js +1 -1
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +29 -15
- package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +14 -1
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +64 -9
- package/dist/components/QuickSwitcher/composition-search.d.ts +16 -0
- package/dist/components/QuickSwitcher/composition-search.js +136 -0
- package/dist/components/ResetZoomButton.js +17 -2
- package/dist/components/SelectedOutlineElement.js +10 -30
- package/dist/components/Timeline/Timeline.js +2 -1
- package/dist/components/Timeline/TimelineAssetField.js +1 -0
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -90
- package/dist/components/Timeline/TimelineDragHandler.js +18 -8
- package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -3
- package/dist/components/Timeline/TimelinePinchZoom.js +14 -4
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +8 -4
- package/dist/components/Timeline/TimelineSequence.js +16 -41
- package/dist/components/Timeline/TimelineSequenceItem.js +14 -35
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +3 -3
- package/dist/components/Timeline/TimelineSlider.js +2 -2
- package/dist/components/Timeline/TimelineWidthProvider.js +15 -8
- package/dist/components/Timeline/TimelineZoomControls.js +25 -8
- package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
- package/dist/components/Timeline/timeline-scroll-logic.d.ts +1 -0
- package/dist/components/Timeline/timeline-scroll-logic.js +21 -17
- package/dist/components/Timeline/use-delete-timeline-items.d.ts +1 -0
- package/dist/components/Timeline/use-delete-timeline-items.js +118 -0
- package/dist/components/Timeline/use-timeline-asset-drop.js +8 -14
- package/dist/components/WebMcp.js +61 -8
- package/dist/components/ZoomPersistor.js +2 -2
- package/dist/components/composition-drag-data.d.ts +36 -0
- package/dist/components/composition-drag-data.js +232 -0
- package/dist/components/drop-handler-data.d.ts +2 -1
- package/dist/components/drop-handler-data.js +6 -4
- package/dist/components/effect-drag-and-drop.d.ts +2 -5
- package/dist/components/handle-drop.js +6 -2
- package/dist/components/import-assets.d.ts +5 -13
- package/dist/error-overlay/current-error.d.ts +13 -0
- package/dist/error-overlay/current-error.js +21 -0
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +5 -1
- package/dist/esm/{chunk-1fkq5bfq.js → chunk-np6q13k5.js} +21571 -18952
- package/dist/esm/index.mjs +4 -1
- package/dist/esm/internals.mjs +17206 -14587
- package/dist/esm/previewEntry.mjs +19510 -16804
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/create-folder-tree.js +2 -5
- package/dist/helpers/document-title.d.ts +2 -0
- package/dist/helpers/document-title.js +14 -3
- package/dist/helpers/get-timeline-max-zoom.d.ts +34 -28
- package/dist/helpers/get-timeline-max-zoom.js +46 -29
- package/dist/helpers/install-fiber-sequence-order-observer.d.ts +37 -0
- package/dist/helpers/install-fiber-sequence-order-observer.js +109 -0
- package/dist/helpers/open-in-editor.js +2 -1
- package/dist/helpers/use-runtime-values.d.ts +1 -1
- package/dist/helpers/use-runtime-values.js +5 -4
- package/dist/helpers/use-sync-external-store.d.ts +3 -0
- package/dist/helpers/use-sync-external-store.js +5 -0
- package/dist/previewEntry.js +2 -0
- package/dist/state/modals.d.ts +18 -2
- package/dist/state/timeline-sequence-hover.js +3 -2
- package/dist/state/timeline-zoom.d.ts +0 -1
- package/dist/state/timeline-zoom.js +13 -6
- package/package.json +16 -16
- package/dist/helpers/sort-by-nonce-history.d.ts +0 -1
- package/dist/helpers/sort-by-nonce-history.js +0 -6
|
@@ -1,118 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineDeleteKeybindings = void 0;
|
|
4
|
-
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const remotion_1 = require("remotion");
|
|
7
6
|
const client_id_1 = require("../../helpers/client-id");
|
|
8
7
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
9
|
-
const editor_guides_1 = require("../../state/editor-guides");
|
|
10
8
|
const ConfirmationDialog_1 = require("../ConfirmationDialog");
|
|
11
|
-
const delete_selected_timeline_item_1 = require("./delete-selected-timeline-item");
|
|
12
9
|
const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
|
|
13
10
|
const imperative_state_1 = require("./imperative-state");
|
|
14
|
-
const reset_selected_timeline_props_1 = require("./reset-selected-timeline-props");
|
|
15
11
|
const split_selected_timeline_item_1 = require("./split-selected-timeline-item");
|
|
16
12
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
17
|
-
const
|
|
13
|
+
const use_delete_timeline_items_1 = require("./use-delete-timeline-items");
|
|
18
14
|
const TimelineDeleteKeybindings = () => {
|
|
19
15
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
20
16
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
21
17
|
const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
|
|
22
18
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
23
19
|
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
24
|
-
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
25
|
-
const { setGuidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
26
20
|
const { canSelect } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
27
21
|
const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
|
|
28
22
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
23
|
+
const deleteTimelineItems = (0, use_delete_timeline_items_1.useDeleteTimelineItems)();
|
|
29
24
|
(0, react_1.useEffect)(() => {
|
|
30
25
|
if (!canSelect || previewServerState.type !== 'connected') {
|
|
31
26
|
return;
|
|
32
27
|
}
|
|
33
|
-
const { clientId } = previewServerState;
|
|
34
|
-
const handleDelete = () => {
|
|
35
|
-
const timelinePosition = (0, imperative_state_1.getCurrentFrame)();
|
|
36
|
-
const { selectedItems, clearSelection, selectItems } = currentSelection.current;
|
|
37
|
-
const sequences = sequencesRef.current;
|
|
38
|
-
const propStatuses = propStatusesRef.current;
|
|
39
|
-
if (selectedItems.length === 0) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const selectedGuide = selectedItems.find((item) => item.type === 'guide');
|
|
43
|
-
if (selectedGuide) {
|
|
44
|
-
setGuidesList((prevGuides) => {
|
|
45
|
-
const newGuides = prevGuides.filter((guide) => guide.id !== selectedGuide.guideId);
|
|
46
|
-
(0, editor_guides_1.persistGuidesList)(newGuides);
|
|
47
|
-
return newGuides;
|
|
48
|
-
});
|
|
49
|
-
clearSelection();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const deletePromise = (0, delete_selected_timeline_item_1.deleteSelectedTimelineItems)({
|
|
53
|
-
selections: selectedItems,
|
|
54
|
-
sequences,
|
|
55
|
-
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
56
|
-
setPropStatuses,
|
|
57
|
-
clientId,
|
|
58
|
-
confirm,
|
|
59
|
-
propStatuses,
|
|
60
|
-
timelinePosition,
|
|
61
|
-
});
|
|
62
|
-
if (deletePromise !== null) {
|
|
63
|
-
deletePromise
|
|
64
|
-
.then((deleted) => {
|
|
65
|
-
if (deleted) {
|
|
66
|
-
const nextSelection = (0, delete_selected_timeline_item_1.getTimelineSelectionAfterDeletingItems)({
|
|
67
|
-
selections: selectedItems,
|
|
68
|
-
sequences,
|
|
69
|
-
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
70
|
-
propStatuses,
|
|
71
|
-
timelinePosition,
|
|
72
|
-
});
|
|
73
|
-
if (nextSelection.length === 0) {
|
|
74
|
-
clearSelection();
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
selectItems(nextSelection);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
.catch(() => undefined);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const easingSelections = (0, update_selected_easing_1.getEasingSelections)(selectedItems);
|
|
85
|
-
if (easingSelections.length === selectedItems.length) {
|
|
86
|
-
const resetEasingPromise = (0, update_selected_easing_1.updateSelectedTimelineEasings)({
|
|
87
|
-
selections: easingSelections,
|
|
88
|
-
sequences,
|
|
89
|
-
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
90
|
-
propStatuses,
|
|
91
|
-
setPropStatuses,
|
|
92
|
-
clientId,
|
|
93
|
-
easing: studio_shared_1.LINEAR_KEYFRAME_EASING,
|
|
94
|
-
});
|
|
95
|
-
if (resetEasingPromise !== null) {
|
|
96
|
-
resetEasingPromise.catch(() => undefined);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const resetPromise = (0, reset_selected_timeline_props_1.resetSelectedTimelineProps)({
|
|
101
|
-
selections: selectedItems,
|
|
102
|
-
sequences,
|
|
103
|
-
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
104
|
-
propStatuses,
|
|
105
|
-
setPropStatuses,
|
|
106
|
-
clientId,
|
|
107
|
-
});
|
|
108
|
-
if (resetPromise !== null) {
|
|
109
|
-
resetPromise.catch(() => undefined);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
28
|
const backspace = keybindings.registerKeybinding({
|
|
113
29
|
event: 'keydown',
|
|
114
30
|
key: 'Backspace',
|
|
115
|
-
callback:
|
|
31
|
+
callback: () => deleteTimelineItems(null),
|
|
116
32
|
commandCtrlKey: false,
|
|
117
33
|
preventDefault: true,
|
|
118
34
|
triggerIfInputFieldFocused: false,
|
|
@@ -121,7 +37,7 @@ const TimelineDeleteKeybindings = () => {
|
|
|
121
37
|
const deleteKey = keybindings.registerKeybinding({
|
|
122
38
|
event: 'keydown',
|
|
123
39
|
key: 'Delete',
|
|
124
|
-
callback:
|
|
40
|
+
callback: () => deleteTimelineItems(null),
|
|
125
41
|
commandCtrlKey: false,
|
|
126
42
|
preventDefault: true,
|
|
127
43
|
triggerIfInputFieldFocused: false,
|
|
@@ -190,13 +106,12 @@ const TimelineDeleteKeybindings = () => {
|
|
|
190
106
|
canSelect,
|
|
191
107
|
confirm,
|
|
192
108
|
currentSelection,
|
|
109
|
+
deleteTimelineItems,
|
|
193
110
|
keybindings,
|
|
194
111
|
overrideIdToNodePathMappings,
|
|
195
112
|
propStatusesRef,
|
|
196
113
|
previewServerState,
|
|
197
114
|
sequencesRef,
|
|
198
|
-
setGuidesList,
|
|
199
|
-
setPropStatuses,
|
|
200
115
|
]);
|
|
201
116
|
return null;
|
|
202
117
|
};
|
|
@@ -38,6 +38,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
38
38
|
const player_1 = require("@remotion/player");
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const remotion_1 = require("remotion");
|
|
41
|
+
const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
|
|
41
42
|
const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
|
|
42
43
|
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
43
44
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
@@ -73,22 +74,32 @@ const getClientXWithScroll = (x) => {
|
|
|
73
74
|
};
|
|
74
75
|
const TimelineDragHandler = () => {
|
|
75
76
|
const video = remotion_1.Internals.useUnsafeVideoConfig();
|
|
77
|
+
const timelineSize = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
|
|
78
|
+
triggerOnWindowResize: true,
|
|
79
|
+
shouldApplyCssTransforms: true,
|
|
80
|
+
});
|
|
76
81
|
const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
77
82
|
const { canvasContent, currentAssetMetadata } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
78
83
|
const containerStyle = (0, react_1.useMemo)(() => {
|
|
79
84
|
var _a;
|
|
85
|
+
var _b, _c, _d, _e;
|
|
80
86
|
if (!canvasContent) {
|
|
81
87
|
return {};
|
|
82
88
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
const durationInFrames = (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : 1;
|
|
90
|
+
const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
|
|
91
|
+
durationInFrames,
|
|
92
|
+
timelineViewportWidth: (_d = (_c = timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width) !== null && _c !== void 0 ? _c : (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _d !== void 0 ? _d : 0,
|
|
93
|
+
zoom: canvasContent.type === 'composition'
|
|
94
|
+
? ((_e = zoomMap[canvasContent.compositionId]) !== null && _e !== void 0 ? _e : null)
|
|
95
|
+
: null,
|
|
96
|
+
});
|
|
86
97
|
return {
|
|
87
98
|
...container,
|
|
88
|
-
width:
|
|
99
|
+
width: (0, get_timeline_max_zoom_1.getTimelineWidth)({ durationInFrames, zoom }),
|
|
89
100
|
height: TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
90
101
|
};
|
|
91
|
-
}, [canvasContent, zoomMap]);
|
|
102
|
+
}, [canvasContent, timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width, video === null || video === void 0 ? void 0 : video.durationInFrames, zoomMap]);
|
|
92
103
|
const hasPlayableContent = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ||
|
|
93
104
|
((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' &&
|
|
94
105
|
(currentAssetMetadata === null || currentAssetMetadata === void 0 ? void 0 : currentAssetMetadata.asset) === canvasContent.asset);
|
|
@@ -100,7 +111,6 @@ const TimelineDragHandler = () => {
|
|
|
100
111
|
exports.TimelineDragHandler = TimelineDragHandler;
|
|
101
112
|
const TimelineDragHandlerInner = () => {
|
|
102
113
|
var _a;
|
|
103
|
-
var _b, _c;
|
|
104
114
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
105
115
|
const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
|
|
106
116
|
triggerOnWindowResize: true,
|
|
@@ -108,8 +118,8 @@ const TimelineDragHandlerInner = () => {
|
|
|
108
118
|
});
|
|
109
119
|
const { isHighestContext } = (0, z_index_1.useZIndex)();
|
|
110
120
|
const setFrame = remotion_1.Internals.useTimelineSetFrame();
|
|
111
|
-
const width = (
|
|
112
|
-
const left = (
|
|
121
|
+
const width = (0, timeline_scroll_logic_1.getTimelineContentWidth)();
|
|
122
|
+
const left = (_a = size === null || size === void 0 ? void 0 : size.left) !== null && _a !== void 0 ? _a : 0;
|
|
113
123
|
const [dragging, setDragging] = (0, react_1.useState)({
|
|
114
124
|
dragging: false,
|
|
115
125
|
});
|
|
@@ -65,7 +65,6 @@ const TimelineInOutDragHandler = () => {
|
|
|
65
65
|
exports.TimelineInOutDragHandler = TimelineInOutDragHandler;
|
|
66
66
|
const TimelineInOutDragHandlerInner = () => {
|
|
67
67
|
var _a;
|
|
68
|
-
var _b, _c;
|
|
69
68
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
70
69
|
const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
|
|
71
70
|
triggerOnWindowResize: true,
|
|
@@ -82,8 +81,8 @@ const TimelineInOutDragHandlerInner = () => {
|
|
|
82
81
|
}
|
|
83
82
|
return (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth);
|
|
84
83
|
}, [timelineWidth, videoConfig.durationInFrames]);
|
|
85
|
-
const width = (
|
|
86
|
-
const left = (
|
|
84
|
+
const width = (0, timeline_scroll_logic_1.getTimelineContentWidth)();
|
|
85
|
+
const left = (_a = size === null || size === void 0 ? void 0 : size.left) !== null && _a !== void 0 ? _a : 0;
|
|
87
86
|
const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
|
|
88
87
|
const { setInAndOutFrames } = (0, in_out_1.useTimelineSetInOutFramePosition)();
|
|
89
88
|
const onInPointerDown = (0, react_1.useCallback)((e) => {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelinePinchZoom = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
|
|
6
7
|
const is_current_selected_still_1 = require("../../helpers/is-current-selected-still");
|
|
7
8
|
const editor_zoom_gestures_1 = require("../../state/editor-zoom-gestures");
|
|
8
9
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
@@ -22,6 +23,15 @@ const TimelinePinchZoom = () => {
|
|
|
22
23
|
const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
|
|
23
24
|
const zoomRef = (0, react_1.useRef)(zoom);
|
|
24
25
|
zoomRef.current = zoom;
|
|
26
|
+
const getCurrentTimelineZoom = (0, react_1.useCallback)((compositionId) => {
|
|
27
|
+
var _a;
|
|
28
|
+
var _b, _c, _d;
|
|
29
|
+
return (0, get_timeline_max_zoom_1.getTimelineZoom)({
|
|
30
|
+
durationInFrames: (_b = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _b !== void 0 ? _b : 1,
|
|
31
|
+
timelineViewportWidth: (_c = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _c !== void 0 ? _c : 0,
|
|
32
|
+
zoom: (_d = zoomRef.current[compositionId]) !== null && _d !== void 0 ? _d : null,
|
|
33
|
+
});
|
|
34
|
+
}, [videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames]);
|
|
25
35
|
const pinchBaseZoomRef = (0, react_1.useRef)(null);
|
|
26
36
|
const suppressWheelFromWebKitPinchRef = (0, react_1.useRef)(false);
|
|
27
37
|
const touchPinchRef = (0, react_1.useRef)(null);
|
|
@@ -89,7 +99,6 @@ const TimelinePinchZoom = () => {
|
|
|
89
99
|
suppressWheelFromWebKitPinchRef.current = false;
|
|
90
100
|
};
|
|
91
101
|
const onGestureStart = (event) => {
|
|
92
|
-
var _a;
|
|
93
102
|
const e = event;
|
|
94
103
|
if (!isVideoComposition) {
|
|
95
104
|
return;
|
|
@@ -106,7 +115,7 @@ const TimelinePinchZoom = () => {
|
|
|
106
115
|
}
|
|
107
116
|
e.preventDefault();
|
|
108
117
|
suppressWheelFromWebKitPinchRef.current = true;
|
|
109
|
-
pinchBaseZoomRef.current = (
|
|
118
|
+
pinchBaseZoomRef.current = getCurrentTimelineZoom(canvasContent.compositionId);
|
|
110
119
|
};
|
|
111
120
|
const onGestureChange = (event) => {
|
|
112
121
|
const e = event;
|
|
@@ -153,6 +162,7 @@ const TimelinePinchZoom = () => {
|
|
|
153
162
|
isVideoComposition,
|
|
154
163
|
videoConfig,
|
|
155
164
|
canvasContent,
|
|
165
|
+
getCurrentTimelineZoom,
|
|
156
166
|
setZoom,
|
|
157
167
|
]);
|
|
158
168
|
(0, react_1.useEffect)(() => {
|
|
@@ -161,7 +171,6 @@ const TimelinePinchZoom = () => {
|
|
|
161
171
|
return;
|
|
162
172
|
}
|
|
163
173
|
const onTouchStart = (event) => {
|
|
164
|
-
var _a;
|
|
165
174
|
if (event.touches.length !== 2) {
|
|
166
175
|
touchPinchRef.current = null;
|
|
167
176
|
return;
|
|
@@ -181,7 +190,7 @@ const TimelinePinchZoom = () => {
|
|
|
181
190
|
}
|
|
182
191
|
touchPinchRef.current = {
|
|
183
192
|
initialDistance,
|
|
184
|
-
initialZoom: (
|
|
193
|
+
initialZoom: getCurrentTimelineZoom(canvasContent.compositionId),
|
|
185
194
|
};
|
|
186
195
|
};
|
|
187
196
|
const onTouchMove = (event) => {
|
|
@@ -233,6 +242,7 @@ const TimelinePinchZoom = () => {
|
|
|
233
242
|
isVideoComposition,
|
|
234
243
|
videoConfig,
|
|
235
244
|
canvasContent,
|
|
245
|
+
getCurrentTimelineZoom,
|
|
236
246
|
setZoom,
|
|
237
247
|
]);
|
|
238
248
|
return null;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelinePlayCursorSyncer = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
|
|
6
7
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
7
8
|
const imperative_state_1 = require("./imperative-state");
|
|
8
9
|
const timeline_refs_1 = require("./timeline-refs");
|
|
@@ -10,9 +11,10 @@ const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
|
|
|
10
11
|
let lastTimelinePositionWhileScrolling = null;
|
|
11
12
|
const TimelinePlayCursorSyncer = () => {
|
|
12
13
|
var _a;
|
|
14
|
+
var _b, _c, _d;
|
|
13
15
|
const video = remotion_1.Internals.useVideo();
|
|
14
16
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
15
|
-
const
|
|
17
|
+
const playing = remotion_1.Internals.usePlaying();
|
|
16
18
|
const { playbackRate } = remotion_1.Internals.usePlaybackRate();
|
|
17
19
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
18
20
|
const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
@@ -21,9 +23,11 @@ const TimelinePlayCursorSyncer = () => {
|
|
|
21
23
|
: null;
|
|
22
24
|
// Asset previews have a synthetic video config, but no composition ID
|
|
23
25
|
// with which to look up a persisted timeline zoom.
|
|
24
|
-
const zoom =
|
|
25
|
-
|
|
26
|
-
:
|
|
26
|
+
const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
|
|
27
|
+
durationInFrames: (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : 1,
|
|
28
|
+
timelineViewportWidth: (_c = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _c !== void 0 ? _c : 0,
|
|
29
|
+
zoom: compositionId ? ((_d = zoomMap[compositionId]) !== null && _d !== void 0 ? _d : null) : null,
|
|
30
|
+
});
|
|
27
31
|
if (video) {
|
|
28
32
|
(0, imperative_state_1.setCurrentFrame)(timelinePosition);
|
|
29
33
|
(0, imperative_state_1.setCurrentZoom)(zoom);
|
|
@@ -50,11 +50,8 @@ const modals_1 = require("../../state/modals");
|
|
|
50
50
|
const AudioWaveform_1 = require("../AudioWaveform");
|
|
51
51
|
const ConfirmationDialog_1 = require("../ConfirmationDialog");
|
|
52
52
|
const ContextMenu_1 = require("../ContextMenu");
|
|
53
|
-
const delete_jsx_node_api_1 = require("../delete-jsx-node-api");
|
|
54
53
|
const InitialCompositionLoader_1 = require("../InitialCompositionLoader");
|
|
55
|
-
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
56
54
|
const use_select_asset_1 = require("../use-select-asset");
|
|
57
|
-
const delete_selected_timeline_item_1 = require("./delete-selected-timeline-item");
|
|
58
55
|
const disable_sequence_interactivity_1 = require("./disable-sequence-interactivity");
|
|
59
56
|
const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
|
|
60
57
|
const get_sequence_context_menu_items_1 = require("./get-sequence-context-menu-items");
|
|
@@ -69,6 +66,7 @@ const TimelineSequenceRightEdgeDragHandle_1 = require("./TimelineSequenceRightEd
|
|
|
69
66
|
const TimelineVideoInfo_1 = require("./TimelineVideoInfo");
|
|
70
67
|
const TimelineViewport_1 = require("./TimelineViewport");
|
|
71
68
|
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
69
|
+
const use_delete_timeline_items_1 = require("./use-delete-timeline-items");
|
|
72
70
|
const use_open_sequence_in_apps_1 = require("./use-open-sequence-in-apps");
|
|
73
71
|
const use_sequence_freeze_frame_menu_item_1 = require("./use-sequence-freeze-frame-menu-item");
|
|
74
72
|
const TimelineSequenceFn = ({ s, connectedCompositions, nodePathInfo, sequenceFrameOffset, cascadedStart, localStart, }) => {
|
|
@@ -121,8 +119,6 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premount, po
|
|
|
121
119
|
var _a, _b, _c;
|
|
122
120
|
const ref = (0, react_1.useRef)(null);
|
|
123
121
|
const { onSelect, selectable, selected, selectionItem } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
124
|
-
const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(nodePathInfo);
|
|
125
|
-
const { selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
126
122
|
(0, TimelineSelection_1.useTimelineMarqueeSelectableItem)(selectionItem, ref);
|
|
127
123
|
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
128
124
|
if (e.button === 0) {
|
|
@@ -160,14 +156,13 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premount, po
|
|
|
160
156
|
? negativeStart.left + negativeStart.width
|
|
161
157
|
: 0;
|
|
162
158
|
const actualStyle = (0, react_1.useMemo)(() => {
|
|
163
|
-
const hasSelectedTrack = selectedItems.some((item) => item.type !== 'guide');
|
|
164
159
|
return {
|
|
165
160
|
...style,
|
|
166
161
|
background: negativeStart ? colors_1.TRANSPARENT : style.background,
|
|
167
162
|
border: negativeStart ? 'none' : style.border,
|
|
168
|
-
opacity:
|
|
163
|
+
opacity: selected ? 1 : 0.75,
|
|
169
164
|
};
|
|
170
|
-
}, [
|
|
165
|
+
}, [negativeStart, selected, style]);
|
|
171
166
|
const content = (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [premount ? (jsx_runtime_1.jsx("div", { style: {
|
|
172
167
|
left: premount.left,
|
|
173
168
|
width: premount.width,
|
|
@@ -280,6 +275,7 @@ const TimelineSequenceInner = ({ s, connectedCompositions, windowWidth, nodePath
|
|
|
280
275
|
const selectAsset = (0, use_select_asset_1.useSelectAsset)();
|
|
281
276
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
282
277
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
278
|
+
const deleteTimelineItems = (0, use_delete_timeline_items_1.useDeleteTimelineItems)();
|
|
283
279
|
const { onSelect, selectable, selected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
284
280
|
const { selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
285
281
|
const selectedSequenceNodePathInfos = (0, react_1.useMemo)(() => {
|
|
@@ -348,41 +344,17 @@ const TimelineSequenceInner = ({ s, connectedCompositions, windowWidth, nodePath
|
|
|
348
344
|
}
|
|
349
345
|
(0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)(selectedSequenceNodePathInfos, confirm).catch(() => undefined);
|
|
350
346
|
}, [confirm, previewInteractive, selectedSequenceNodePathInfos]);
|
|
351
|
-
const onDeleteSequenceFromSource = (0, react_1.useCallback)(
|
|
352
|
-
if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) ||
|
|
347
|
+
const onDeleteSequenceFromSource = (0, react_1.useCallback)(() => {
|
|
348
|
+
if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) ||
|
|
349
|
+
!nodePath ||
|
|
350
|
+
!nodePathInfo ||
|
|
351
|
+
deleteDisabled) {
|
|
353
352
|
return;
|
|
354
353
|
}
|
|
355
|
-
|
|
356
|
-
const shouldDelete = await confirm({
|
|
357
|
-
title: 'Delete sequence?',
|
|
358
|
-
message: 'This sequence is programmatically duplicated ' +
|
|
359
|
-
nodePathInfo.numberOfSequencesWithThisNodePath +
|
|
360
|
-
' times in the code. Deleting removes all instances. Continue?',
|
|
361
|
-
confirmLabel: 'Delete',
|
|
362
|
-
});
|
|
363
|
-
if (!shouldDelete) {
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
try {
|
|
368
|
-
const result = await (0, delete_jsx_node_api_1.deleteJsxNode)({
|
|
369
|
-
nodes: [
|
|
370
|
-
{
|
|
371
|
-
fileName: validatedLocation.source,
|
|
372
|
-
nodePath: nodePath.nodePath,
|
|
373
|
-
},
|
|
374
|
-
],
|
|
375
|
-
});
|
|
376
|
-
if (!result.success) {
|
|
377
|
-
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
catch (err) {
|
|
381
|
-
(0, NotificationCenter_1.showNotification)(err.message, 4000);
|
|
382
|
-
}
|
|
354
|
+
deleteTimelineItems([{ type: 'sequence', nodePathInfo }]);
|
|
383
355
|
}, [
|
|
384
|
-
confirm,
|
|
385
356
|
deleteDisabled,
|
|
357
|
+
deleteTimelineItems,
|
|
386
358
|
nodePath,
|
|
387
359
|
nodePathInfo,
|
|
388
360
|
validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
|
|
@@ -391,8 +363,11 @@ const TimelineSequenceInner = ({ s, connectedCompositions, windowWidth, nodePath
|
|
|
391
363
|
if (!previewInteractive || selectedSequenceNodePathInfos === null) {
|
|
392
364
|
return;
|
|
393
365
|
}
|
|
394
|
-
(
|
|
395
|
-
|
|
366
|
+
deleteTimelineItems(selectedSequenceNodePathInfos.map((selectedNodePathInfo) => ({
|
|
367
|
+
type: 'sequence',
|
|
368
|
+
nodePathInfo: selectedNodePathInfo,
|
|
369
|
+
})));
|
|
370
|
+
}, [deleteTimelineItems, previewInteractive, selectedSequenceNodePathInfos]);
|
|
396
371
|
const onDisableSequenceInteractivity = (0, react_1.useCallback)(() => {
|
|
397
372
|
if (disableInteractivityDisabled ||
|
|
398
373
|
!nodePath ||
|
|
@@ -53,7 +53,6 @@ const transform_3d_mode_1 = require("../../state/transform-3d-mode");
|
|
|
53
53
|
const CompositionOrStillIcon_1 = require("../CompositionOrStillIcon");
|
|
54
54
|
const ConfirmationDialog_1 = require("../ConfirmationDialog");
|
|
55
55
|
const ContextMenu_1 = require("../ContextMenu");
|
|
56
|
-
const delete_jsx_node_api_1 = require("../delete-jsx-node-api");
|
|
57
56
|
const effect_drag_and_drop_1 = require("../effect-drag-and-drop");
|
|
58
57
|
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
59
58
|
const InitialCompositionLoader_1 = require("../InitialCompositionLoader");
|
|
@@ -62,7 +61,6 @@ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
|
62
61
|
const reorder_sequence_api_1 = require("../reorder-sequence-api");
|
|
63
62
|
const selected_outline_types_1 = require("../selected-outline-types");
|
|
64
63
|
const use_select_asset_1 = require("../use-select-asset");
|
|
65
|
-
const delete_selected_timeline_item_1 = require("./delete-selected-timeline-item");
|
|
66
64
|
const disable_sequence_interactivity_1 = require("./disable-sequence-interactivity");
|
|
67
65
|
const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
|
|
68
66
|
const get_sequence_context_menu_items_1 = require("./get-sequence-context-menu-items");
|
|
@@ -77,6 +75,7 @@ const TimelineMediaInfo_1 = require("./TimelineMediaInfo");
|
|
|
77
75
|
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
78
76
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
79
77
|
const TimelineSequenceName_1 = require("./TimelineSequenceName");
|
|
78
|
+
const use_delete_timeline_items_1 = require("./use-delete-timeline-items");
|
|
80
79
|
const use_open_sequence_in_apps_1 = require("./use-open-sequence-in-apps");
|
|
81
80
|
const use_rename_sequence_1 = require("./use-rename-sequence");
|
|
82
81
|
const use_sequence_freeze_frame_menu_item_1 = require("./use-sequence-freeze-frame-menu-item");
|
|
@@ -194,6 +193,7 @@ const TimelineSequenceItemInner = ({ afterDropLineOffset, connectedCompositions,
|
|
|
194
193
|
const { isHighestContext } = (0, use_keybinding_1.useKeybinding)();
|
|
195
194
|
const selectAsset = (0, use_select_asset_1.useSelectAsset)();
|
|
196
195
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
196
|
+
const deleteTimelineItems = (0, use_delete_timeline_items_1.useDeleteTimelineItems)();
|
|
197
197
|
const { onSelect, selectable, selected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
198
198
|
const { selectItem, selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
199
199
|
const selectedSequenceNodePathInfos = (0, react_1.useMemo)(() => {
|
|
@@ -261,41 +261,17 @@ const TimelineSequenceItemInner = ({ afterDropLineOffset, connectedCompositions,
|
|
|
261
261
|
}
|
|
262
262
|
(0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)(selectedSequenceNodePathInfos, confirm).catch(() => undefined);
|
|
263
263
|
}, [confirm, previewInteractive, selectedSequenceNodePathInfos]);
|
|
264
|
-
const onDeleteSequenceFromSource = (0, react_1.useCallback)(
|
|
265
|
-
if (deleteDisabled ||
|
|
264
|
+
const onDeleteSequenceFromSource = (0, react_1.useCallback)(() => {
|
|
265
|
+
if (deleteDisabled ||
|
|
266
|
+
!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) ||
|
|
267
|
+
!nodePath ||
|
|
268
|
+
!nodePathInfo) {
|
|
266
269
|
return;
|
|
267
270
|
}
|
|
268
|
-
|
|
269
|
-
const shouldDelete = await confirm({
|
|
270
|
-
title: 'Delete sequence?',
|
|
271
|
-
message: 'This sequence is programmatically duplicated ' +
|
|
272
|
-
nodePathInfo.numberOfSequencesWithThisNodePath +
|
|
273
|
-
' times in the code. Deleting removes all instances. Continue?',
|
|
274
|
-
confirmLabel: 'Delete',
|
|
275
|
-
});
|
|
276
|
-
if (!shouldDelete) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
try {
|
|
281
|
-
const result = await (0, delete_jsx_node_api_1.deleteJsxNode)({
|
|
282
|
-
nodes: [
|
|
283
|
-
{
|
|
284
|
-
fileName: validatedLocation.source,
|
|
285
|
-
nodePath: nodePath.nodePath,
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
|
-
});
|
|
289
|
-
if (!result.success) {
|
|
290
|
-
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
catch (err) {
|
|
294
|
-
(0, NotificationCenter_1.showNotification)(err.message, 4000);
|
|
295
|
-
}
|
|
271
|
+
deleteTimelineItems([{ type: 'sequence', nodePathInfo }]);
|
|
296
272
|
}, [
|
|
297
|
-
confirm,
|
|
298
273
|
deleteDisabled,
|
|
274
|
+
deleteTimelineItems,
|
|
299
275
|
nodePath,
|
|
300
276
|
validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
|
|
301
277
|
nodePathInfo,
|
|
@@ -304,8 +280,11 @@ const TimelineSequenceItemInner = ({ afterDropLineOffset, connectedCompositions,
|
|
|
304
280
|
if (!previewInteractive || selectedSequenceNodePathInfos === null) {
|
|
305
281
|
return;
|
|
306
282
|
}
|
|
307
|
-
(
|
|
308
|
-
|
|
283
|
+
deleteTimelineItems(selectedSequenceNodePathInfos.map((selectedNodePathInfo) => ({
|
|
284
|
+
type: 'sequence',
|
|
285
|
+
nodePathInfo: selectedNodePathInfo,
|
|
286
|
+
})));
|
|
287
|
+
}, [deleteTimelineItems, previewInteractive, selectedSequenceNodePathInfos]);
|
|
309
288
|
const onDisableSequenceInteractivity = (0, react_1.useCallback)(() => {
|
|
310
289
|
if (disableInteractivityDisabled ||
|
|
311
290
|
!nodePath ||
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.TimelineSequenceRightEdgeDragHandle = exports.useTimelineSequenceFromDrag = exports.TimelineSequenceLeftEdgeDragHandle = exports.getTimelineSequenceFromDragTargets = exports.getTimelineSequenceLeftEdgeDragTargets = exports.getTimelineSequenceDurationDragTargets = exports.getTimelineSequenceFromDragKeyframeMoves = exports.getTimelineSequenceFromDragChanges = exports.getTimelineSequenceFromDragDelta = exports.getTimelineSequenceFromDragValue = exports.getTimelineSequenceDurationDragChanges = exports.getTimelineSequenceLeftEdgeDragChanges = exports.getTimelineSequenceLeftEdgeDragValues = exports.getTimelineSequenceLeftEdgeDragDelta = exports.getTimelineSequenceDurationDragValue = exports.isTimelineSequenceLeftEdgeDraggable = exports.canResizeTimelineSequenceDuration = exports.isTimelineSequenceDurationDraggable = exports.isCascadingSequence = exports.isTransitionSeriesSequence = exports.timelineSequenceFromDragSnapThresholdPx = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const canvas_1 = require("@remotion/canvas");
|
|
38
39
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
39
40
|
const react_1 = __importStar(require("react"));
|
|
40
41
|
const remotion_1 = require("remotion");
|
|
@@ -43,7 +44,6 @@ const calculate_timeline_1 = require("../../helpers/calculate-timeline");
|
|
|
43
44
|
const client_id_1 = require("../../helpers/client-id");
|
|
44
45
|
const colors_1 = require("../../helpers/colors");
|
|
45
46
|
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
46
|
-
const sort_by_nonce_history_1 = require("../../helpers/sort-by-nonce-history");
|
|
47
47
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
48
48
|
const editor_snapping_1 = require("../../state/editor-snapping");
|
|
49
49
|
const ForceSpecificCursor_1 = require("../ForceSpecificCursor");
|
|
@@ -168,9 +168,9 @@ const getMinimumSequenceDuration = ({ sequence, sequences, }) => {
|
|
|
168
168
|
if (!(0, exports.isTransitionSeriesSequence)(sequence)) {
|
|
169
169
|
return 1;
|
|
170
170
|
}
|
|
171
|
-
const siblings = (0,
|
|
171
|
+
const siblings = (0, canvas_1.sortItemsByCommitOrder)(sequences.filter((candidate) => candidate.parent === sequence.parent &&
|
|
172
172
|
((0, exports.isTransitionSeriesSequence)(candidate) ||
|
|
173
|
-
isTransitionSeriesTransition(candidate))));
|
|
173
|
+
isTransitionSeriesTransition(candidate))), (candidate) => candidate.timelineOrder);
|
|
174
174
|
const sequenceIndex = siblings.findIndex((candidate) => candidate.id === sequence.id);
|
|
175
175
|
if (sequenceIndex === -1) {
|
|
176
176
|
return 1;
|
|
@@ -60,8 +60,8 @@ const TimelineSliderInner = () => {
|
|
|
60
60
|
throw new Error('Unexpectedly did not have timeline width');
|
|
61
61
|
}
|
|
62
62
|
const zoomLevel = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition'
|
|
63
|
-
? ((_a = zoomMap[canvasContent.compositionId]) !== null && _a !== void 0 ? _a :
|
|
64
|
-
:
|
|
63
|
+
? ((_a = zoomMap[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : null)
|
|
64
|
+
: null;
|
|
65
65
|
(0, react_1.useLayoutEffect)(() => {
|
|
66
66
|
var _a;
|
|
67
67
|
const el = ref.current;
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const player_1 = require("@remotion/player");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
|
+
const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
|
|
8
9
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
9
10
|
const timeline_refs_1 = require("./timeline-refs");
|
|
10
11
|
exports.TimelineWidthContext = (0, react_1.createContext)(null);
|
|
@@ -15,18 +16,24 @@ const TimelineWidthProvider = ({ children }) => {
|
|
|
15
16
|
});
|
|
16
17
|
const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
17
18
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
19
|
+
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
18
20
|
const width = (0, react_1.useMemo)(() => {
|
|
19
21
|
var _a, _b;
|
|
20
|
-
var _c, _d, _e;
|
|
21
|
-
const
|
|
22
|
-
? ((_c = zoomMap[canvasContent.compositionId]) !== null && _c !== void 0 ? _c : timeline_zoom_1.TIMELINE_MIN_ZOOM)
|
|
23
|
-
: timeline_zoom_1.TIMELINE_MIN_ZOOM;
|
|
24
|
-
const scrollableWidth = (_d = size === null || size === void 0 ? void 0 : size.width) !== null && _d !== void 0 ? _d : (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
22
|
+
var _c, _d, _e, _f;
|
|
23
|
+
const scrollableWidth = (_c = size === null || size === void 0 ? void 0 : size.width) !== null && _c !== void 0 ? _c : (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
25
24
|
if (scrollableWidth === undefined) {
|
|
26
|
-
return (
|
|
25
|
+
return (_d = (_b = timeline_refs_1.sliderAreaRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _d !== void 0 ? _d : null;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const durationInFrames = (_e = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _e !== void 0 ? _e : 1;
|
|
28
|
+
const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
|
|
29
|
+
durationInFrames,
|
|
30
|
+
timelineViewportWidth: scrollableWidth,
|
|
31
|
+
zoom: (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition'
|
|
32
|
+
? ((_f = zoomMap[canvasContent.compositionId]) !== null && _f !== void 0 ? _f : null)
|
|
33
|
+
: null,
|
|
34
|
+
});
|
|
35
|
+
return (0, get_timeline_max_zoom_1.getTimelineWidth)({ durationInFrames, zoom });
|
|
36
|
+
}, [canvasContent, size === null || size === void 0 ? void 0 : size.width, videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames, zoomMap]);
|
|
30
37
|
return (jsx_runtime_1.jsx(exports.TimelineWidthContext.Provider, { value: width, children: children }));
|
|
31
38
|
};
|
|
32
39
|
exports.TimelineWidthProvider = TimelineWidthProvider;
|