@remotion/studio 4.0.444 → 4.0.445
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Canvas.js +197 -42
- package/dist/components/Timeline/Timeline.js +8 -5
- package/dist/components/Timeline/TimelinePinchZoom.d.ts +2 -0
- package/dist/components/Timeline/TimelinePinchZoom.js +240 -0
- package/dist/components/Timeline/TimelineSlider.js +22 -8
- package/dist/components/Timeline/TimelineZoomControls.js +6 -3
- package/dist/components/Timeline/timeline-scroll-logic.d.ts +13 -1
- package/dist/components/Timeline/timeline-scroll-logic.js +20 -6
- package/dist/esm/{chunk-1zvzzrkf.js → chunk-bqd9dhnk.js} +1991 -1539
- package/dist/esm/internals.mjs +1991 -1539
- package/dist/esm/previewEntry.mjs +1948 -1496
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-effective-translation.d.ts +13 -1
- package/dist/helpers/get-effective-translation.js +45 -1
- package/dist/state/timeline-zoom.d.ts +5 -1
- package/dist/state/timeline-zoom.js +21 -16
- package/package.json +9 -9
package/dist/esm/renderEntry.mjs
CHANGED
|
@@ -208,7 +208,7 @@ var renderContent = (Root) => {
|
|
|
208
208
|
renderToDOM(/* @__PURE__ */ jsx("div", {
|
|
209
209
|
children: /* @__PURE__ */ jsx(DelayedSpinner, {})
|
|
210
210
|
}));
|
|
211
|
-
import("./chunk-
|
|
211
|
+
import("./chunk-bqd9dhnk.js").then(({ StudioInternals }) => {
|
|
212
212
|
window.remotion_isStudio = true;
|
|
213
213
|
window.remotion_isReadOnlyStudio = true;
|
|
214
214
|
window.remotion_inputProps = "{}";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Size } from '@remotion/player';
|
|
2
|
-
import type
|
|
2
|
+
import { type PreviewSize, type Translation } from 'remotion';
|
|
3
3
|
export declare const getEffectiveTranslation: ({ canvasSize, scale, compositionHeight, compositionWidth, translation, }: {
|
|
4
4
|
canvasSize: Size;
|
|
5
5
|
scale: number;
|
|
@@ -25,3 +25,15 @@ export declare const getCenterPointWhileScrolling: ({ size, clientX, clientY, co
|
|
|
25
25
|
centerX: number;
|
|
26
26
|
centerY: number;
|
|
27
27
|
};
|
|
28
|
+
export declare const applyZoomAroundFocalPoint: ({ canvasSize, contentDimensions, previewSizeBefore, oldNumericSize, newNumericSize, clientX, clientY, }: {
|
|
29
|
+
readonly canvasSize: Size;
|
|
30
|
+
readonly contentDimensions: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
readonly previewSizeBefore: PreviewSize;
|
|
35
|
+
readonly oldNumericSize: number;
|
|
36
|
+
readonly newNumericSize: number;
|
|
37
|
+
readonly clientX: number;
|
|
38
|
+
readonly clientY: number;
|
|
39
|
+
}) => PreviewSize;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCenterPointWhileScrolling = exports.getEffectiveTranslation = void 0;
|
|
3
|
+
exports.applyZoomAroundFocalPoint = exports.getCenterPointWhileScrolling = exports.getEffectiveTranslation = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const smooth_zoom_1 = require("./smooth-zoom");
|
|
4
6
|
const getEffectiveXTranslation = ({ canvasSize, scale, compositionWidth, translation, }) => {
|
|
5
7
|
const maxTranslation = Math.abs(canvasSize.width / 2 +
|
|
6
8
|
(scale * compositionWidth) / 2 -
|
|
@@ -43,3 +45,45 @@ const getCenterPointWhileScrolling = ({ size, clientX, clientY, compositionWidth
|
|
|
43
45
|
};
|
|
44
46
|
};
|
|
45
47
|
exports.getCenterPointWhileScrolling = getCenterPointWhileScrolling;
|
|
48
|
+
const applyZoomAroundFocalPoint = ({ canvasSize, contentDimensions, previewSizeBefore, oldNumericSize, newNumericSize, clientX, clientY, }) => {
|
|
49
|
+
const scale = remotion_1.Internals.calculateScale({
|
|
50
|
+
canvasSize,
|
|
51
|
+
compositionHeight: contentDimensions.height,
|
|
52
|
+
compositionWidth: contentDimensions.width,
|
|
53
|
+
previewSize: previewSizeBefore.size,
|
|
54
|
+
});
|
|
55
|
+
const clampedNew = Math.min(smooth_zoom_1.MAX_ZOOM, Math.max(smooth_zoom_1.MIN_ZOOM, newNumericSize));
|
|
56
|
+
if (clampedNew === oldNumericSize) {
|
|
57
|
+
return previewSizeBefore;
|
|
58
|
+
}
|
|
59
|
+
const { centerX, centerY } = (0, exports.getCenterPointWhileScrolling)({
|
|
60
|
+
size: canvasSize,
|
|
61
|
+
clientX,
|
|
62
|
+
clientY,
|
|
63
|
+
compositionWidth: contentDimensions.width,
|
|
64
|
+
compositionHeight: contentDimensions.height,
|
|
65
|
+
scale,
|
|
66
|
+
translation: previewSizeBefore.translation,
|
|
67
|
+
});
|
|
68
|
+
const zoomDifference = clampedNew - oldNumericSize;
|
|
69
|
+
const uvCoordinatesX = centerX / contentDimensions.width;
|
|
70
|
+
const uvCoordinatesY = centerY / contentDimensions.height;
|
|
71
|
+
const correctionLeft = -uvCoordinatesX * (zoomDifference * contentDimensions.width) +
|
|
72
|
+
(1 - uvCoordinatesX) * zoomDifference * contentDimensions.width;
|
|
73
|
+
const correctionTop = -uvCoordinatesY * (zoomDifference * contentDimensions.height) +
|
|
74
|
+
(1 - uvCoordinatesY) * zoomDifference * contentDimensions.height;
|
|
75
|
+
return {
|
|
76
|
+
size: clampedNew,
|
|
77
|
+
translation: (0, exports.getEffectiveTranslation)({
|
|
78
|
+
translation: {
|
|
79
|
+
x: previewSizeBefore.translation.x - correctionLeft / 2,
|
|
80
|
+
y: previewSizeBefore.translation.y - correctionTop / 2,
|
|
81
|
+
},
|
|
82
|
+
canvasSize,
|
|
83
|
+
compositionHeight: contentDimensions.height,
|
|
84
|
+
compositionWidth: contentDimensions.width,
|
|
85
|
+
scale,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.applyZoomAroundFocalPoint = applyZoomAroundFocalPoint;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const TIMELINE_MIN_ZOOM = 1;
|
|
3
3
|
export declare const TIMELINE_MAX_ZOOM = 5;
|
|
4
|
+
export type TimelineSetZoomOptions = {
|
|
5
|
+
anchorFrame: number | null;
|
|
6
|
+
anchorContentX: number | null;
|
|
7
|
+
};
|
|
4
8
|
export declare const TimelineZoomCtx: React.Context<{
|
|
5
9
|
zoom: Record<string, number>;
|
|
6
|
-
setZoom: (compositionId: string, prev: (prevZoom: number) => number) => void;
|
|
10
|
+
setZoom: (compositionId: string, prev: (prevZoom: number) => number, options?: TimelineSetZoomOptions | undefined) => void;
|
|
7
11
|
}>;
|
|
8
12
|
export declare const TimelineZoomContext: React.FC<{
|
|
9
13
|
readonly children: React.ReactNode;
|
|
@@ -15,26 +15,31 @@ exports.TimelineZoomCtx = (0, react_1.createContext)({
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
const TimelineZoomContext = ({ children }) => {
|
|
18
|
-
const [zoom,
|
|
18
|
+
const [zoom, setZoomState] = (0, react_1.useState)(() => (0, ZoomPersistor_1.getZoomFromLocalStorage)());
|
|
19
|
+
const setZoom = (0, react_1.useCallback)((compositionId, callback, options) => {
|
|
20
|
+
setZoomState((prevZoomMap) => {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
const newZoomWithFloatingPointErrors = Math.min(exports.TIMELINE_MAX_ZOOM, Math.max(exports.TIMELINE_MIN_ZOOM, callback((_a = prevZoomMap[compositionId]) !== null && _a !== void 0 ? _a : exports.TIMELINE_MIN_ZOOM)));
|
|
23
|
+
const newZoom = Math.round(newZoomWithFloatingPointErrors * 10) / 10;
|
|
24
|
+
const anchorFrame = (_b = options === null || options === void 0 ? void 0 : options.anchorFrame) !== null && _b !== void 0 ? _b : null;
|
|
25
|
+
const anchorContentX = (_c = options === null || options === void 0 ? void 0 : options.anchorContentX) !== null && _c !== void 0 ? _c : null;
|
|
26
|
+
(0, timeline_scroll_logic_1.zoomAndPreserveCursor)({
|
|
27
|
+
oldZoom: (_d = prevZoomMap[compositionId]) !== null && _d !== void 0 ? _d : exports.TIMELINE_MIN_ZOOM,
|
|
28
|
+
newZoom,
|
|
29
|
+
currentDurationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
30
|
+
currentFrame: (0, imperative_state_1.getCurrentFrame)(),
|
|
31
|
+
anchorFrame,
|
|
32
|
+
anchorContentX,
|
|
33
|
+
});
|
|
34
|
+
return { ...prevZoomMap, [compositionId]: newZoom };
|
|
35
|
+
});
|
|
36
|
+
}, []);
|
|
19
37
|
const value = (0, react_1.useMemo)(() => {
|
|
20
38
|
return {
|
|
21
39
|
zoom,
|
|
22
|
-
setZoom
|
|
23
|
-
setZoom((prevZoomMap) => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
const newZoomWithFloatingPointErrors = Math.min(exports.TIMELINE_MAX_ZOOM, Math.max(exports.TIMELINE_MIN_ZOOM, callback((_a = prevZoomMap[compositionId]) !== null && _a !== void 0 ? _a : exports.TIMELINE_MIN_ZOOM)));
|
|
26
|
-
const newZoom = Math.round(newZoomWithFloatingPointErrors * 10) / 10;
|
|
27
|
-
(0, timeline_scroll_logic_1.zoomAndPreserveCursor)({
|
|
28
|
-
oldZoom: (_b = prevZoomMap[compositionId]) !== null && _b !== void 0 ? _b : exports.TIMELINE_MIN_ZOOM,
|
|
29
|
-
newZoom,
|
|
30
|
-
currentDurationInFrames: (0, imperative_state_1.getCurrentDuration)(),
|
|
31
|
-
currentFrame: (0, imperative_state_1.getCurrentFrame)(),
|
|
32
|
-
});
|
|
33
|
-
return { ...prevZoomMap, [compositionId]: newZoom };
|
|
34
|
-
});
|
|
35
|
-
},
|
|
40
|
+
setZoom,
|
|
36
41
|
};
|
|
37
|
-
}, [zoom]);
|
|
42
|
+
}, [zoom, setZoom]);
|
|
38
43
|
return (jsx_runtime_1.jsx(exports.TimelineZoomCtx.Provider, { value: value, children: children }));
|
|
39
44
|
};
|
|
40
45
|
exports.TimelineZoomContext = TimelineZoomContext;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.445",
|
|
7
7
|
"description": "APIs for interacting with the Remotion Studio",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"semver": "7.5.3",
|
|
29
|
-
"remotion": "4.0.
|
|
30
|
-
"@remotion/player": "4.0.
|
|
31
|
-
"@remotion/media-utils": "4.0.
|
|
32
|
-
"@remotion/renderer": "4.0.
|
|
33
|
-
"@remotion/web-renderer": "4.0.
|
|
34
|
-
"@remotion/studio-shared": "4.0.
|
|
35
|
-
"@remotion/zod-types": "4.0.
|
|
29
|
+
"remotion": "4.0.445",
|
|
30
|
+
"@remotion/player": "4.0.445",
|
|
31
|
+
"@remotion/media-utils": "4.0.445",
|
|
32
|
+
"@remotion/renderer": "4.0.445",
|
|
33
|
+
"@remotion/web-renderer": "4.0.445",
|
|
34
|
+
"@remotion/studio-shared": "4.0.445",
|
|
35
|
+
"@remotion/zod-types": "4.0.445",
|
|
36
36
|
"mediabunny": "1.39.2",
|
|
37
37
|
"memfs": "3.4.3",
|
|
38
38
|
"source-map": "0.7.3",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react": "19.2.3",
|
|
44
44
|
"react-dom": "19.2.3",
|
|
45
45
|
"@types/semver": "^7.3.4",
|
|
46
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
46
|
+
"@remotion/eslint-config-internal": "4.0.445",
|
|
47
47
|
"eslint": "9.19.0",
|
|
48
48
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
49
49
|
},
|