@remotion/cli 3.1.11 → 3.2.2
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/bundle.d.ts +1 -1
- package/dist/bundle.js +3 -2
- package/dist/config/bundle-out-dir.d.ts +2 -0
- package/dist/config/bundle-out-dir.js +12 -0
- package/dist/config/enforce-audio-track.d.ts +2 -0
- package/dist/config/enforce-audio-track.js +13 -0
- package/dist/config/get-public-path.d.ts +2 -0
- package/dist/config/get-public-path.js +12 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.js +8 -0
- package/dist/config/muted.d.ts +2 -0
- package/dist/config/muted.js +13 -0
- package/dist/editor/components/Editor.js +3 -1
- package/dist/editor/components/InitialCompositionLoader.js +13 -0
- package/dist/editor/components/Notifications/ServerDisconnected.d.ts +5 -0
- package/dist/editor/components/Notifications/ServerDisconnected.js +56 -0
- package/dist/editor/components/PlayPause.js +41 -23
- package/dist/editor/components/PreviewToolbar.js +2 -2
- package/dist/editor/components/Splitter/SplitterElement.js +1 -0
- package/dist/editor/components/TimeValue.js +9 -5
- package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
- package/dist/editor/components/Timeline/MaxTimelineTracks.js +5 -3
- package/dist/editor/components/Timeline/Timeline.js +11 -4
- package/dist/editor/components/Timeline/TimelineDragHandler.js +120 -23
- package/dist/editor/components/Timeline/TimelineList.js +5 -4
- package/dist/editor/components/Timeline/TimelineListItem.d.ts +1 -0
- package/dist/editor/components/Timeline/TimelineListItem.js +8 -4
- package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.d.ts +2 -0
- package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +76 -0
- package/dist/editor/components/Timeline/TimelineScrollable.js +4 -2
- package/dist/editor/components/Timeline/TimelineSlider.d.ts +3 -0
- package/dist/editor/components/Timeline/TimelineSlider.js +35 -2
- package/dist/editor/components/Timeline/TimelineSliderHandle.js +1 -3
- package/dist/editor/components/Timeline/TimelineTimeIndicators.d.ts +5 -0
- package/dist/editor/components/Timeline/TimelineTimeIndicators.js +168 -0
- package/dist/editor/components/Timeline/TimelineTracks.js +14 -9
- package/dist/editor/components/Timeline/TimelineZoomControls.js +18 -2
- package/dist/editor/components/Timeline/imperative-state.d.ts +12 -0
- package/dist/editor/components/Timeline/imperative-state.js +39 -0
- package/dist/editor/components/Timeline/timeline-refs.d.ts +2 -0
- package/dist/editor/components/Timeline/timeline-refs.js +3 -1
- package/dist/editor/components/Timeline/timeline-scroll-logic.d.ts +40 -0
- package/dist/editor/components/Timeline/timeline-scroll-logic.js +206 -1
- package/dist/editor/components/ZoomPersistor.d.ts +4 -0
- package/dist/editor/components/ZoomPersistor.js +37 -0
- package/dist/editor/helpers/colors.d.ts +2 -1
- package/dist/editor/helpers/colors.js +2 -1
- package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +1 -0
- package/dist/editor/helpers/get-left-of-timeline-slider.js +7 -4
- package/dist/editor/helpers/get-timeline-sequence-layout.js +29 -9
- package/dist/editor/icons/minus.d.ts +3 -0
- package/dist/editor/icons/minus.js +8 -0
- package/dist/editor/icons/plus.d.ts +3 -0
- package/dist/editor/icons/plus.js +8 -0
- package/dist/editor/state/timeline-zoom.d.ts +1 -1
- package/dist/editor/state/timeline-zoom.js +15 -1
- package/dist/event-source.js +6 -0
- package/dist/get-cli-options.d.ts +2 -0
- package/dist/get-cli-options.js +2 -0
- package/dist/handle-common-errors.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/parse-command-line.d.ts +2 -0
- package/dist/parse-command-line.js +8 -0
- package/dist/prepare-entry-point.d.ts +3 -2
- package/dist/prepare-entry-point.js +3 -2
- package/dist/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.js +9 -1
- package/dist/preview-server/error-overlay/remotion-overlay/Button.js +1 -1
- package/dist/preview-server/error-overlay/remotion-overlay/CodeFrame.js +2 -0
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorMessage.js +4 -2
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.js +1 -1
- package/dist/preview-server/error-overlay/remotion-overlay/StackFrame.js +3 -1
- package/dist/preview-server/get-package-manager.d.ts +1 -0
- package/dist/preview-server/get-package-manager.js +8 -1
- package/dist/preview-server/live-events.js +4 -0
- package/dist/preview-server/routes.js +19 -2
- package/dist/preview-server/start-server.js +1 -1
- package/dist/previewEntry.js +6 -0
- package/dist/progress-bar.js +7 -2
- package/dist/render.js +3 -1
- package/dist/upgrade.js +1 -0
- package/dist/versions.js +1 -0
- package/package.json +7 -7
- package/dist/bundle-on-cli.d.ts +0 -2
- package/dist/bundle-on-cli.js +0 -41
- package/dist/chalk/symbols.d.ts +0 -111
- package/dist/chalk/symbols.js +0 -75
- package/dist/chalk/utilities.d.ts +0 -2
- package/dist/chalk/utilities.js +0 -37
- package/dist/editor/components/CompositionManager.d.ts +0 -4
- package/dist/editor/components/CompositionManager.js +0 -60
- package/dist/editor/components/LoadingIndicator.d.ts +0 -2
- package/dist/editor/components/LoadingIndicator.js +0 -35
- package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
- package/dist/preview-server/fast-refresh/helpers.js +0 -145
- package/dist/preview-server/fast-refresh/index.d.ts +0 -30
- package/dist/preview-server/fast-refresh/index.js +0 -86
- package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
- package/dist/preview-server/fast-refresh/loader.js +0 -81
- package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
- package/dist/preview-server/fast-refresh/runtime.js +0 -32
- package/dist/preview-server/static-preview.d.ts +0 -1
- package/dist/preview-server/static-preview.js +0 -40
- package/dist/preview-server/webpack-cache.d.ts +0 -12
- package/dist/preview-server/webpack-cache.js +0 -66
- package/dist/webpack-cache.d.ts +0 -12
- package/dist/webpack-cache.js +0 -66
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineTimeIndicators = exports.TimelineTimePadding = exports.TimelineTimePlaceholders = exports.TIMELINE_TIME_INDICATOR_HEIGHT = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const player_1 = require("@remotion/player");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
8
|
+
const colors_1 = require("../../helpers/colors");
|
|
9
|
+
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
10
|
+
const render_frame_1 = require("../../state/render-frame");
|
|
11
|
+
const TimeValue_1 = require("../TimeValue");
|
|
12
|
+
const timeline_refs_1 = require("./timeline-refs");
|
|
13
|
+
const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
|
|
14
|
+
const TimelineListItem_1 = require("./TimelineListItem");
|
|
15
|
+
exports.TIMELINE_TIME_INDICATOR_HEIGHT = 30;
|
|
16
|
+
const container = {
|
|
17
|
+
height: exports.TIMELINE_TIME_INDICATOR_HEIGHT - 4,
|
|
18
|
+
boxShadow: `0 0 4px ${colors_1.TIMELINE_BACKGROUND}`,
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
backgroundColor: colors_1.TIMELINE_BACKGROUND,
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
};
|
|
24
|
+
const tick = {
|
|
25
|
+
width: 1,
|
|
26
|
+
backgroundColor: 'rgba(255, 255, 255, 0.15)',
|
|
27
|
+
height: 20,
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
};
|
|
30
|
+
const secondTick = {
|
|
31
|
+
...tick,
|
|
32
|
+
height: 15,
|
|
33
|
+
};
|
|
34
|
+
const tickLabel = {
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
marginLeft: 8,
|
|
37
|
+
marginTop: 7,
|
|
38
|
+
color: colors_1.LIGHT_TEXT,
|
|
39
|
+
};
|
|
40
|
+
const timeValue = {
|
|
41
|
+
height: exports.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: 0,
|
|
44
|
+
width: '100%',
|
|
45
|
+
paddingLeft: TimelineListItem_1.TOTAL_TIMELINE_LAYER_LEFT_PADDING,
|
|
46
|
+
boxShadow: `0 0 20px ${colors_1.BACKGROUND}`,
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
background: colors_1.BACKGROUND,
|
|
50
|
+
};
|
|
51
|
+
const TimelineTimePlaceholders = () => {
|
|
52
|
+
const ref = (0, react_1.useRef)(null);
|
|
53
|
+
(0, react_1.useEffect)(() => {
|
|
54
|
+
const currentRef = ref.current;
|
|
55
|
+
if (!currentRef) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const { current } = timeline_refs_1.timelineVerticalScroll;
|
|
59
|
+
if (!current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const onScroll = () => {
|
|
63
|
+
currentRef.style.top = current.scrollTop + 'px';
|
|
64
|
+
};
|
|
65
|
+
current.addEventListener('scroll', onScroll);
|
|
66
|
+
return () => {
|
|
67
|
+
current.removeEventListener('scroll', onScroll);
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: timeValue, children: (0, jsx_runtime_1.jsx)(TimeValue_1.TimeValue, {}) }));
|
|
71
|
+
};
|
|
72
|
+
exports.TimelineTimePlaceholders = TimelineTimePlaceholders;
|
|
73
|
+
const TimelineTimePadding = () => {
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
75
|
+
height: exports.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
76
|
+
} }));
|
|
77
|
+
};
|
|
78
|
+
exports.TimelineTimePadding = TimelineTimePadding;
|
|
79
|
+
const TimelineTimeIndicators = () => {
|
|
80
|
+
var _a;
|
|
81
|
+
const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.sliderAreaRef, {
|
|
82
|
+
triggerOnWindowResize: false,
|
|
83
|
+
shouldApplyCssTransforms: true,
|
|
84
|
+
});
|
|
85
|
+
const video = remotion_1.Internals.useVideo();
|
|
86
|
+
const windowWidth = (_a = size === null || size === void 0 ? void 0 : size.width) !== null && _a !== void 0 ? _a : 0;
|
|
87
|
+
const ref = (0, react_1.useRef)(null);
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
const currentRef = ref.current;
|
|
90
|
+
if (!currentRef) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const { current } = timeline_refs_1.timelineVerticalScroll;
|
|
94
|
+
if (!current) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const onScroll = () => {
|
|
98
|
+
currentRef.style.top = current.scrollTop + 'px';
|
|
99
|
+
};
|
|
100
|
+
current.addEventListener('scroll', onScroll);
|
|
101
|
+
return () => {
|
|
102
|
+
current.removeEventListener('scroll', onScroll);
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
const style = (0, react_1.useMemo)(() => {
|
|
106
|
+
return {
|
|
107
|
+
...container,
|
|
108
|
+
width: windowWidth,
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
};
|
|
111
|
+
}, [windowWidth]);
|
|
112
|
+
const ticks = (0, react_1.useMemo)(() => {
|
|
113
|
+
if (!video) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
const frameInterval = (0, timeline_scroll_logic_1.getFrameIncrementFromWidth)(video.durationInFrames, windowWidth);
|
|
117
|
+
const MIN_SPACING_BETWEEN_TICKS_PX = 5;
|
|
118
|
+
const seconds = Math.floor(video.durationInFrames / video.fps);
|
|
119
|
+
const secondMarkerEveryNth = Math.ceil((MIN_SPACING_BETWEEN_TICKS_PX * video.fps) / (frameInterval * video.fps));
|
|
120
|
+
const frameMarkerEveryNth = Math.ceil(MIN_SPACING_BETWEEN_TICKS_PX / frameInterval);
|
|
121
|
+
// Big ticks showing for every second
|
|
122
|
+
const secondTicks = new Array(seconds)
|
|
123
|
+
.fill(true)
|
|
124
|
+
.map((_, index) => {
|
|
125
|
+
return {
|
|
126
|
+
frame: index * video.fps,
|
|
127
|
+
style: {
|
|
128
|
+
...secondTick,
|
|
129
|
+
left: frameInterval * index * video.fps + timeline_layout_1.TIMELINE_PADDING,
|
|
130
|
+
},
|
|
131
|
+
showTime: index > 0,
|
|
132
|
+
};
|
|
133
|
+
})
|
|
134
|
+
.filter((_, idx) => idx % secondMarkerEveryNth === 0);
|
|
135
|
+
const frameTicks = new Array(video.durationInFrames)
|
|
136
|
+
.fill(true)
|
|
137
|
+
.map((_, index) => {
|
|
138
|
+
return {
|
|
139
|
+
frame: index,
|
|
140
|
+
style: {
|
|
141
|
+
...tick,
|
|
142
|
+
left: frameInterval * index + timeline_layout_1.TIMELINE_PADDING,
|
|
143
|
+
height: index % video.fps === 0
|
|
144
|
+
? 10
|
|
145
|
+
: (index / frameMarkerEveryNth) % 2 === 0
|
|
146
|
+
? 5
|
|
147
|
+
: 2,
|
|
148
|
+
},
|
|
149
|
+
showTime: false,
|
|
150
|
+
};
|
|
151
|
+
})
|
|
152
|
+
.filter((_, idx) => idx % frameMarkerEveryNth === 0);
|
|
153
|
+
// Merge and deduplicate ticks
|
|
154
|
+
const hasTicks = [];
|
|
155
|
+
return [...secondTicks, ...frameTicks].filter((t) => {
|
|
156
|
+
const alreadyUsed = hasTicks.find((ht) => ht === t.frame) !== undefined;
|
|
157
|
+
hasTicks.push(t.frame);
|
|
158
|
+
return !alreadyUsed;
|
|
159
|
+
});
|
|
160
|
+
}, [video, windowWidth]);
|
|
161
|
+
if (!video) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: style, children: ticks.map((t) => {
|
|
165
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: t.style, children: t.showTime ? ((0, jsx_runtime_1.jsx)("div", { style: tickLabel, children: (0, render_frame_1.renderFrame)(t.frame, video.fps) })) : null }, t.frame));
|
|
166
|
+
}) }));
|
|
167
|
+
};
|
|
168
|
+
exports.TimelineTimeIndicators = TimelineTimeIndicators;
|
|
@@ -7,14 +7,13 @@ const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
|
7
7
|
const is_collapsed_1 = require("./is-collapsed");
|
|
8
8
|
const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
|
|
9
9
|
const TimelineSequence_1 = require("./TimelineSequence");
|
|
10
|
+
const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
|
|
10
11
|
const content = {
|
|
11
12
|
paddingLeft: timeline_layout_1.TIMELINE_PADDING,
|
|
12
13
|
paddingRight: timeline_layout_1.TIMELINE_PADDING,
|
|
13
14
|
};
|
|
14
15
|
const timelineContent = {
|
|
15
|
-
|
|
16
|
-
backgroundColor: '#111111',
|
|
17
|
-
width: '100%',
|
|
16
|
+
minHeight: '100%',
|
|
18
17
|
};
|
|
19
18
|
const TimelineTracks = ({ timeline, fps, viewState, hasBeenCut }) => {
|
|
20
19
|
const inner = (0, react_1.useMemo)(() => {
|
|
@@ -22,11 +21,17 @@ const TimelineTracks = ({ timeline, fps, viewState, hasBeenCut }) => {
|
|
|
22
21
|
height: timeline_layout_1.TIMELINE_LAYER_HEIGHT + timeline_layout_1.TIMELINE_BORDER * 2,
|
|
23
22
|
};
|
|
24
23
|
}, []);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const timelineStyle = (0, react_1.useMemo)(() => {
|
|
25
|
+
return {
|
|
26
|
+
...timelineContent,
|
|
27
|
+
width: 100 + '%',
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: timelineStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: content, children: [(0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
|
|
31
|
+
if ((0, is_collapsed_1.isTrackHidden)(track, timeline, viewState)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: inner, children: (0, jsx_runtime_1.jsx)(TimelineSequence_1.TimelineSequence, { fps: fps, s: track.sequence }) }, track.sequence.id));
|
|
35
|
+
}), (0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimeIndicators, {})] }), hasBeenCut ? (0, jsx_runtime_1.jsx)(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
|
|
31
36
|
};
|
|
32
37
|
exports.TimelineTracks = TimelineTracks;
|
|
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineZoomControls = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const is_current_selected_still_1 = require("../../helpers/is-current-selected-still");
|
|
7
|
+
const minus_1 = require("../../icons/minus");
|
|
8
|
+
const plus_1 = require("../../icons/plus");
|
|
6
9
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
7
10
|
const ControlButton_1 = require("../ControlButton");
|
|
11
|
+
const layout_1 = require("../layout");
|
|
8
12
|
const container = {
|
|
9
13
|
color: 'black',
|
|
10
14
|
flexDirection: 'row',
|
|
@@ -13,6 +17,14 @@ const container = {
|
|
|
13
17
|
const buttonStyle = {
|
|
14
18
|
fontSize: 24,
|
|
15
19
|
};
|
|
20
|
+
const iconStyle = {
|
|
21
|
+
color: 'white',
|
|
22
|
+
width: 14,
|
|
23
|
+
};
|
|
24
|
+
const slider = {
|
|
25
|
+
width: 60,
|
|
26
|
+
accentColor: 'var(--blue)',
|
|
27
|
+
};
|
|
16
28
|
const TimelineZoomControls = () => {
|
|
17
29
|
const { setZoom, zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
18
30
|
const onMinusClicked = (0, react_1.useCallback)(() => {
|
|
@@ -22,8 +34,12 @@ const TimelineZoomControls = () => {
|
|
|
22
34
|
setZoom((z) => Math.min(timeline_zoom_1.TIMELINE_MAX_ZOOM, z + 0.2));
|
|
23
35
|
}, [setZoom]);
|
|
24
36
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
25
|
-
setZoom(Number(e.target.value));
|
|
37
|
+
setZoom(() => Number(e.target.value));
|
|
26
38
|
}, [setZoom]);
|
|
27
|
-
|
|
39
|
+
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
40
|
+
if (isStill) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onMinusClicked, style: buttonStyle, title: "Zoom out timeline", role: 'ControlButton', type: "button", disabled: timeline_zoom_1.TIMELINE_MIN_ZOOM === zoom, children: (0, jsx_runtime_1.jsx)(minus_1.Minus, { style: iconStyle }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)("input", { title: `Timeline zoom (${zoom}x)`, alt: `Timeline zoom (${zoom}x)`, type: 'range', min: timeline_zoom_1.TIMELINE_MIN_ZOOM, step: 0.1, value: zoom, max: timeline_zoom_1.TIMELINE_MAX_ZOOM, onChange: onChange, style: slider }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onPlusClicked, style: buttonStyle, title: "Zoom in timeline", role: 'button', type: "button", disabled: timeline_zoom_1.TIMELINE_MAX_ZOOM === zoom, children: (0, jsx_runtime_1.jsx)(plus_1.Plus, { style: iconStyle }) })] }));
|
|
28
44
|
};
|
|
29
45
|
exports.TimelineZoomControls = TimelineZoomControls;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare let currentFrame: number;
|
|
2
|
+
export declare let currentZoom: number;
|
|
3
|
+
export declare let currentDuration: number;
|
|
4
|
+
export declare let currentFps: number;
|
|
5
|
+
export declare const getCurrentZoom: () => number;
|
|
6
|
+
export declare const setCurrentZoom: (z: number) => void;
|
|
7
|
+
export declare const getCurrentFrame: () => number;
|
|
8
|
+
export declare const setCurrentFrame: (f: number) => void;
|
|
9
|
+
export declare const getCurrentDuration: () => number;
|
|
10
|
+
export declare const setCurrentDuration: (d: number) => void;
|
|
11
|
+
export declare const getCurrentFps: () => number;
|
|
12
|
+
export declare const setCurrentFps: (d: number) => void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setCurrentFps = exports.getCurrentFps = exports.setCurrentDuration = exports.getCurrentDuration = exports.setCurrentFrame = exports.getCurrentFrame = exports.setCurrentZoom = exports.getCurrentZoom = exports.currentFps = exports.currentDuration = exports.currentZoom = exports.currentFrame = void 0;
|
|
4
|
+
exports.currentFrame = 0;
|
|
5
|
+
exports.currentZoom = 1;
|
|
6
|
+
exports.currentDuration = 1;
|
|
7
|
+
exports.currentFps = 1;
|
|
8
|
+
const getCurrentZoom = () => {
|
|
9
|
+
return exports.currentZoom;
|
|
10
|
+
};
|
|
11
|
+
exports.getCurrentZoom = getCurrentZoom;
|
|
12
|
+
const setCurrentZoom = (z) => {
|
|
13
|
+
exports.currentZoom = z;
|
|
14
|
+
};
|
|
15
|
+
exports.setCurrentZoom = setCurrentZoom;
|
|
16
|
+
const getCurrentFrame = () => {
|
|
17
|
+
return exports.currentFrame;
|
|
18
|
+
};
|
|
19
|
+
exports.getCurrentFrame = getCurrentFrame;
|
|
20
|
+
const setCurrentFrame = (f) => {
|
|
21
|
+
exports.currentFrame = f;
|
|
22
|
+
};
|
|
23
|
+
exports.setCurrentFrame = setCurrentFrame;
|
|
24
|
+
const getCurrentDuration = () => {
|
|
25
|
+
return exports.currentDuration;
|
|
26
|
+
};
|
|
27
|
+
exports.getCurrentDuration = getCurrentDuration;
|
|
28
|
+
const setCurrentDuration = (d) => {
|
|
29
|
+
exports.currentDuration = d;
|
|
30
|
+
};
|
|
31
|
+
exports.setCurrentDuration = setCurrentDuration;
|
|
32
|
+
const getCurrentFps = () => {
|
|
33
|
+
return exports.currentFps;
|
|
34
|
+
};
|
|
35
|
+
exports.getCurrentFps = getCurrentFps;
|
|
36
|
+
const setCurrentFps = (d) => {
|
|
37
|
+
exports.currentFps = d;
|
|
38
|
+
};
|
|
39
|
+
exports.setCurrentFps = setCurrentFps;
|
|
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sliderAreaRef = void 0;
|
|
6
|
+
exports.timelineVerticalScroll = exports.scrollableRef = exports.sliderAreaRef = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
exports.sliderAreaRef = react_1.default.createRef();
|
|
9
|
+
exports.scrollableRef = react_1.default.createRef();
|
|
10
|
+
exports.timelineVerticalScroll = react_1.default.createRef();
|
|
@@ -2,3 +2,43 @@ export declare const canScrollTimelineIntoDirection: () => {
|
|
|
2
2
|
canScrollRight: boolean;
|
|
3
3
|
canScrollLeft: boolean;
|
|
4
4
|
};
|
|
5
|
+
export declare const getFrameWhileScrollingLeft: ({ durationInFrames, width, }: {
|
|
6
|
+
durationInFrames: number;
|
|
7
|
+
width: number;
|
|
8
|
+
}) => number;
|
|
9
|
+
export declare const isCursorInViewport: ({ frame, durationInFrames, }: {
|
|
10
|
+
frame: number;
|
|
11
|
+
durationInFrames: number;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
export declare const ensureFrameIsInViewport: ({ direction, durationInFrames, frame, }: {
|
|
14
|
+
direction: 'fit-left' | 'fit-right' | 'page-right' | 'page-left' | 'center';
|
|
15
|
+
durationInFrames: number;
|
|
16
|
+
frame: number;
|
|
17
|
+
}) => void;
|
|
18
|
+
export declare const scrollToTimelineXOffset: (scrollPos: number) => void;
|
|
19
|
+
export declare const getScrollPositionForCursorOnLeftEdge: ({ nextFrame, durationInFrames, }: {
|
|
20
|
+
nextFrame: number;
|
|
21
|
+
durationInFrames: number;
|
|
22
|
+
}) => number;
|
|
23
|
+
export declare const getScrollPositionForCursorOnRightEdge: ({ nextFrame, durationInFrames, }: {
|
|
24
|
+
nextFrame: number;
|
|
25
|
+
durationInFrames: number;
|
|
26
|
+
}) => number;
|
|
27
|
+
export declare const getFrameIncrement: (durationInFrames: number) => number;
|
|
28
|
+
export declare const getFrameIncrementFromWidth: (durationInFrames: number, width: number) => number;
|
|
29
|
+
export declare const getFrameWhileScrollingRight: ({ durationInFrames, width, }: {
|
|
30
|
+
durationInFrames: number;
|
|
31
|
+
width: number;
|
|
32
|
+
}) => number;
|
|
33
|
+
export declare const getFrameFromX: ({ clientX, durationInFrames, width, extrapolate, }: {
|
|
34
|
+
clientX: number;
|
|
35
|
+
durationInFrames: number;
|
|
36
|
+
width: number;
|
|
37
|
+
extrapolate: 'clamp' | 'extend';
|
|
38
|
+
}) => number;
|
|
39
|
+
export declare const zoomAndPreserveCursor: ({ oldZoom, newZoom, currentFrame, currentDurationInFrames, }: {
|
|
40
|
+
oldZoom: number;
|
|
41
|
+
newZoom: number;
|
|
42
|
+
currentFrame: number;
|
|
43
|
+
currentDurationInFrames: number;
|
|
44
|
+
}) => void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canScrollTimelineIntoDirection = void 0;
|
|
3
|
+
exports.zoomAndPreserveCursor = exports.getFrameFromX = exports.getFrameWhileScrollingRight = exports.getFrameIncrementFromWidth = exports.getFrameIncrement = exports.getScrollPositionForCursorOnRightEdge = exports.getScrollPositionForCursorOnLeftEdge = exports.scrollToTimelineXOffset = exports.ensureFrameIsInViewport = exports.isCursorInViewport = exports.getFrameWhileScrollingLeft = exports.canScrollTimelineIntoDirection = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
5
6
|
const timeline_refs_1 = require("./timeline-refs");
|
|
7
|
+
const TimelineSlider_1 = require("./TimelineSlider");
|
|
6
8
|
const canScrollTimelineIntoDirection = () => {
|
|
7
9
|
const current = timeline_refs_1.scrollableRef.current;
|
|
8
10
|
const { scrollWidth, scrollLeft, clientWidth } = current;
|
|
@@ -11,3 +13,206 @@ const canScrollTimelineIntoDirection = () => {
|
|
|
11
13
|
return { canScrollRight, canScrollLeft };
|
|
12
14
|
};
|
|
13
15
|
exports.canScrollTimelineIntoDirection = canScrollTimelineIntoDirection;
|
|
16
|
+
const SCROLL_INCREMENT = 200;
|
|
17
|
+
const calculateFrameWhileScrollingRight = ({ durationInFrames, width, scrollLeft, }) => {
|
|
18
|
+
var _a;
|
|
19
|
+
return ((0, exports.getFrameFromX)({
|
|
20
|
+
clientX: scrollLeft,
|
|
21
|
+
durationInFrames,
|
|
22
|
+
width,
|
|
23
|
+
extrapolate: 'clamp',
|
|
24
|
+
}) +
|
|
25
|
+
Math.ceil((((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) - timeline_layout_1.TIMELINE_PADDING) /
|
|
26
|
+
(0, exports.getFrameIncrement)(durationInFrames)));
|
|
27
|
+
};
|
|
28
|
+
const getFrameWhileScrollingLeft = ({ durationInFrames, width, }) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const nextFrame = (0, exports.getFrameFromX)({
|
|
31
|
+
clientX: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) - SCROLL_INCREMENT,
|
|
32
|
+
durationInFrames,
|
|
33
|
+
width,
|
|
34
|
+
extrapolate: 'clamp',
|
|
35
|
+
});
|
|
36
|
+
const currentFrame = (0, exports.getFrameFromX)({
|
|
37
|
+
clientX: (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollLeft,
|
|
38
|
+
durationInFrames,
|
|
39
|
+
width,
|
|
40
|
+
extrapolate: 'clamp',
|
|
41
|
+
});
|
|
42
|
+
// Should go back at least 1 frame, but not less than 0
|
|
43
|
+
return Math.max(0, Math.min(currentFrame - 1, nextFrame));
|
|
44
|
+
};
|
|
45
|
+
exports.getFrameWhileScrollingLeft = getFrameWhileScrollingLeft;
|
|
46
|
+
const isCursorInViewport = ({ frame, durationInFrames, }) => {
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
|
+
const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
|
|
49
|
+
const scrollLeft = (_d = (_c = timeline_refs_1.scrollableRef.current) === null || _c === void 0 ? void 0 : _c.scrollLeft) !== null && _d !== void 0 ? _d : 0;
|
|
50
|
+
const scrollPosOnRightEdge = (0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
51
|
+
nextFrame: frame,
|
|
52
|
+
durationInFrames,
|
|
53
|
+
});
|
|
54
|
+
const scrollPosOnLeftEdge = (0, exports.getScrollPositionForCursorOnLeftEdge)({
|
|
55
|
+
nextFrame: frame,
|
|
56
|
+
durationInFrames,
|
|
57
|
+
});
|
|
58
|
+
const currentFrameRight = calculateFrameWhileScrollingRight({
|
|
59
|
+
durationInFrames,
|
|
60
|
+
scrollLeft,
|
|
61
|
+
width,
|
|
62
|
+
});
|
|
63
|
+
return !(scrollPosOnRightEdge >=
|
|
64
|
+
(0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
65
|
+
nextFrame: currentFrameRight,
|
|
66
|
+
durationInFrames,
|
|
67
|
+
}) || scrollPosOnLeftEdge < scrollLeft);
|
|
68
|
+
};
|
|
69
|
+
exports.isCursorInViewport = isCursorInViewport;
|
|
70
|
+
const ensureFrameIsInViewport = ({ direction, durationInFrames, frame, }) => {
|
|
71
|
+
var _a, _b, _c, _d, _e;
|
|
72
|
+
(_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(frame);
|
|
73
|
+
const width = (_c = (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _c !== void 0 ? _c : 0;
|
|
74
|
+
const scrollLeft = (_e = (_d = timeline_refs_1.scrollableRef.current) === null || _d === void 0 ? void 0 : _d.scrollLeft) !== null && _e !== void 0 ? _e : 0;
|
|
75
|
+
if (direction === 'fit-left') {
|
|
76
|
+
const currentFrameLeft = (0, exports.getFrameFromX)({
|
|
77
|
+
clientX: scrollLeft,
|
|
78
|
+
durationInFrames,
|
|
79
|
+
width,
|
|
80
|
+
extrapolate: 'clamp',
|
|
81
|
+
});
|
|
82
|
+
const scrollPos = (0, exports.getScrollPositionForCursorOnLeftEdge)({
|
|
83
|
+
nextFrame: frame,
|
|
84
|
+
durationInFrames,
|
|
85
|
+
});
|
|
86
|
+
const needsToScrollLeft = scrollPos <=
|
|
87
|
+
(0, exports.getScrollPositionForCursorOnLeftEdge)({
|
|
88
|
+
nextFrame: currentFrameLeft,
|
|
89
|
+
durationInFrames,
|
|
90
|
+
});
|
|
91
|
+
if (needsToScrollLeft) {
|
|
92
|
+
(0, exports.scrollToTimelineXOffset)(scrollPos);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (direction === 'fit-right') {
|
|
96
|
+
const currentFrameRight = calculateFrameWhileScrollingRight({
|
|
97
|
+
durationInFrames,
|
|
98
|
+
scrollLeft,
|
|
99
|
+
width,
|
|
100
|
+
});
|
|
101
|
+
const scrollPos = (0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
102
|
+
nextFrame: frame,
|
|
103
|
+
durationInFrames,
|
|
104
|
+
});
|
|
105
|
+
const needsToScrollRight = scrollPos >=
|
|
106
|
+
(0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
107
|
+
nextFrame: currentFrameRight,
|
|
108
|
+
durationInFrames,
|
|
109
|
+
});
|
|
110
|
+
if (needsToScrollRight) {
|
|
111
|
+
(0, exports.scrollToTimelineXOffset)(scrollPos);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (direction === 'page-right' || direction === 'page-left') {
|
|
115
|
+
if (!(0, exports.isCursorInViewport)({ frame, durationInFrames })) {
|
|
116
|
+
(0, exports.scrollToTimelineXOffset)(direction === 'page-left'
|
|
117
|
+
? (0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
118
|
+
nextFrame: frame,
|
|
119
|
+
durationInFrames,
|
|
120
|
+
})
|
|
121
|
+
: (0, exports.getScrollPositionForCursorOnLeftEdge)({
|
|
122
|
+
nextFrame: frame,
|
|
123
|
+
durationInFrames,
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (direction === 'center') {
|
|
128
|
+
const scrollPosOnRightEdge = (0, exports.getScrollPositionForCursorOnRightEdge)({
|
|
129
|
+
nextFrame: frame,
|
|
130
|
+
durationInFrames,
|
|
131
|
+
});
|
|
132
|
+
const scrollPosOnLeftEdge = (0, exports.getScrollPositionForCursorOnLeftEdge)({
|
|
133
|
+
nextFrame: frame,
|
|
134
|
+
durationInFrames,
|
|
135
|
+
});
|
|
136
|
+
(0, exports.scrollToTimelineXOffset)((scrollPosOnLeftEdge + scrollPosOnRightEdge) / 2);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.ensureFrameIsInViewport = ensureFrameIsInViewport;
|
|
140
|
+
const scrollToTimelineXOffset = (scrollPos) => {
|
|
141
|
+
var _a;
|
|
142
|
+
(_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scroll({
|
|
143
|
+
left: scrollPos,
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
exports.scrollToTimelineXOffset = scrollToTimelineXOffset;
|
|
147
|
+
const getScrollPositionForCursorOnLeftEdge = ({ nextFrame, durationInFrames, }) => {
|
|
148
|
+
const frameIncrement = (0, exports.getFrameIncrement)(durationInFrames);
|
|
149
|
+
const scrollPos = frameIncrement * nextFrame;
|
|
150
|
+
return scrollPos;
|
|
151
|
+
};
|
|
152
|
+
exports.getScrollPositionForCursorOnLeftEdge = getScrollPositionForCursorOnLeftEdge;
|
|
153
|
+
const getScrollPositionForCursorOnRightEdge = ({ nextFrame, durationInFrames, }) => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const frameIncrement = (0, exports.getFrameIncrement)(durationInFrames);
|
|
156
|
+
const framesRemaining = durationInFrames - 1 - nextFrame;
|
|
157
|
+
const fromRight = framesRemaining * frameIncrement + timeline_layout_1.TIMELINE_PADDING;
|
|
158
|
+
const scrollPos = ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) -
|
|
159
|
+
fromRight -
|
|
160
|
+
((_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) +
|
|
161
|
+
timeline_layout_1.TIMELINE_PADDING +
|
|
162
|
+
4; // clearfix;
|
|
163
|
+
return scrollPos;
|
|
164
|
+
};
|
|
165
|
+
exports.getScrollPositionForCursorOnRightEdge = getScrollPositionForCursorOnRightEdge;
|
|
166
|
+
const getFrameIncrement = (durationInFrames) => {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
|
|
169
|
+
return (0, exports.getFrameIncrementFromWidth)(durationInFrames, width);
|
|
170
|
+
};
|
|
171
|
+
exports.getFrameIncrement = getFrameIncrement;
|
|
172
|
+
const getFrameIncrementFromWidth = (durationInFrames, width) => {
|
|
173
|
+
return (width - timeline_layout_1.TIMELINE_PADDING * 2) / (durationInFrames - 1);
|
|
174
|
+
};
|
|
175
|
+
exports.getFrameIncrementFromWidth = getFrameIncrementFromWidth;
|
|
176
|
+
const getFrameWhileScrollingRight = ({ durationInFrames, width, }) => {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
const nextFrame = calculateFrameWhileScrollingRight({
|
|
179
|
+
durationInFrames,
|
|
180
|
+
width,
|
|
181
|
+
scrollLeft: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) + SCROLL_INCREMENT,
|
|
182
|
+
});
|
|
183
|
+
const currentFrame = calculateFrameWhileScrollingRight({
|
|
184
|
+
durationInFrames,
|
|
185
|
+
width,
|
|
186
|
+
scrollLeft: (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollLeft,
|
|
187
|
+
});
|
|
188
|
+
// Should scroll by at least 1 frame, but not overshoot duration
|
|
189
|
+
return Math.min(durationInFrames - 1, Math.max(nextFrame, currentFrame + 1));
|
|
190
|
+
};
|
|
191
|
+
exports.getFrameWhileScrollingRight = getFrameWhileScrollingRight;
|
|
192
|
+
const getFrameFromX = ({ clientX, durationInFrames, width, extrapolate, }) => {
|
|
193
|
+
var _a;
|
|
194
|
+
const pos = clientX - timeline_layout_1.TIMELINE_PADDING;
|
|
195
|
+
const frame = Math.round((0, remotion_1.interpolate)(pos, [0, width - timeline_layout_1.TIMELINE_PADDING * 2], [0, (_a = durationInFrames - 1) !== null && _a !== void 0 ? _a : 0], {
|
|
196
|
+
extrapolateLeft: extrapolate,
|
|
197
|
+
extrapolateRight: extrapolate,
|
|
198
|
+
}));
|
|
199
|
+
return frame;
|
|
200
|
+
};
|
|
201
|
+
exports.getFrameFromX = getFrameFromX;
|
|
202
|
+
const zoomAndPreserveCursor = ({ oldZoom, newZoom, currentFrame, currentDurationInFrames, }) => {
|
|
203
|
+
var _a, _b, _c;
|
|
204
|
+
const ratio = newZoom / oldZoom;
|
|
205
|
+
if (ratio === 1) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const { current } = timeline_refs_1.scrollableRef;
|
|
209
|
+
if (!current) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const frameIncrement = (0, exports.getFrameIncrement)(currentDurationInFrames);
|
|
213
|
+
const prevCursorPosition = frameIncrement * currentFrame + timeline_layout_1.TIMELINE_PADDING;
|
|
214
|
+
const newCursorPosition = ratio * (prevCursorPosition - timeline_layout_1.TIMELINE_PADDING) + timeline_layout_1.TIMELINE_PADDING;
|
|
215
|
+
current.scrollLeft += newCursorPosition - prevCursorPosition;
|
|
216
|
+
(_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(currentFrame, ((_c = (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _c !== void 0 ? _c : 0) * ratio);
|
|
217
|
+
};
|
|
218
|
+
exports.zoomAndPreserveCursor = zoomAndPreserveCursor;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZoomPersistor = exports.getZoomForComposition = exports.persistCurrentZoom = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const timeline_zoom_1 = require("../state/timeline-zoom");
|
|
7
|
+
const FramePersistor_1 = require("./FramePersistor");
|
|
8
|
+
const makeKey = (composition) => {
|
|
9
|
+
return `remotion.zoom.${composition}`;
|
|
10
|
+
};
|
|
11
|
+
const persistCurrentZoom = (zoom) => {
|
|
12
|
+
const currentComposition = (0, FramePersistor_1.getCurrentCompositionFromUrl)();
|
|
13
|
+
if (!currentComposition) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
localStorage.setItem(makeKey(currentComposition), String(zoom));
|
|
17
|
+
};
|
|
18
|
+
exports.persistCurrentZoom = persistCurrentZoom;
|
|
19
|
+
const getZoomForComposition = (composition) => {
|
|
20
|
+
const zoom = localStorage.getItem(makeKey(composition));
|
|
21
|
+
return zoom ? Number(zoom) : 0;
|
|
22
|
+
};
|
|
23
|
+
exports.getZoomForComposition = getZoomForComposition;
|
|
24
|
+
const ZoomPersistor = () => {
|
|
25
|
+
const [playing] = remotion_1.Internals.Timeline.usePlayingState();
|
|
26
|
+
const { zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
27
|
+
const { currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
28
|
+
const isActive = currentComposition === (0, FramePersistor_1.getCurrentCompositionFromUrl)();
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
if (!isActive) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
(0, exports.persistCurrentZoom)(zoom);
|
|
34
|
+
}, [zoom, isActive, playing]);
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
exports.ZoomPersistor = ZoomPersistor;
|
|
@@ -8,7 +8,8 @@ export declare const SELECTED_HOVER_BACKGROUND = "hsla(0, 0%, 100%, 0.25)";
|
|
|
8
8
|
export declare const CLEAR_HOVER = "rgba(255, 255, 255, 0.06)";
|
|
9
9
|
export declare const INPUT_BORDER_COLOR_UNHOVERED = "rgba(0, 0, 0, 0.6)";
|
|
10
10
|
export declare const INPUT_BORDER_COLOR_HOVERED = "rgba(255, 255, 255, 0.05)";
|
|
11
|
+
export declare const TIMELINE_BACKGROUND = "#111";
|
|
11
12
|
export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
|
|
12
13
|
selected: boolean;
|
|
13
14
|
hovered: boolean;
|
|
14
|
-
}) => "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)"
|
|
15
|
+
}) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBackgroundFromHoverState = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.SELECTED_HOVER_BACKGROUND = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND = void 0;
|
|
3
|
+
exports.getBackgroundFromHoverState = exports.TIMELINE_BACKGROUND = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.SELECTED_HOVER_BACKGROUND = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND = void 0;
|
|
4
4
|
exports.BACKGROUND = '#1f2428';
|
|
5
5
|
exports.INPUT_BACKGROUND = '#2f363d';
|
|
6
6
|
exports.BORDER_COLOR = '#000';
|
|
@@ -11,6 +11,7 @@ exports.SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';
|
|
|
11
11
|
exports.CLEAR_HOVER = 'rgba(255, 255, 255, 0.06)';
|
|
12
12
|
exports.INPUT_BORDER_COLOR_UNHOVERED = 'rgba(0, 0, 0, 0.6)';
|
|
13
13
|
exports.INPUT_BORDER_COLOR_HOVERED = 'rgba(255, 255, 255, 0.05)';
|
|
14
|
+
exports.TIMELINE_BACKGROUND = '#111';
|
|
14
15
|
const getBackgroundFromHoverState = ({ selected, hovered, }) => {
|
|
15
16
|
if (selected) {
|
|
16
17
|
if (hovered) {
|