@umituz/react-native-video-editor 1.1.20 → 1.1.22
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-video-editor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Professional video editor with layer-based timeline, text/image/shape/audio/animation layers, and export functionality",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -33,10 +33,13 @@ export const DraggableLayer: React.FC<DraggableLayerProps> = ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
const tokens = useAppDesignTokens();
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
36
|
+
const safeCanvasWidth = canvasWidth > 0 ? canvasWidth : 1;
|
|
37
|
+
const safeCanvasHeight = canvasHeight > 0 ? canvasHeight : 1;
|
|
38
|
+
|
|
39
|
+
const initialX = (layer.position.x / 100) * safeCanvasWidth;
|
|
40
|
+
const initialY = (layer.position.y / 100) * safeCanvasHeight;
|
|
41
|
+
const initialWidth = (layer.size.width / 100) * safeCanvasWidth;
|
|
42
|
+
const initialHeight = (layer.size.height / 100) * safeCanvasHeight;
|
|
40
43
|
|
|
41
44
|
const {
|
|
42
45
|
state,
|
|
@@ -50,8 +53,8 @@ export const DraggableLayer: React.FC<DraggableLayerProps> = ({
|
|
|
50
53
|
initialY,
|
|
51
54
|
initialWidth,
|
|
52
55
|
initialHeight,
|
|
53
|
-
canvasWidth,
|
|
54
|
-
canvasHeight,
|
|
56
|
+
canvasWidth: safeCanvasWidth,
|
|
57
|
+
canvasHeight: safeCanvasHeight,
|
|
55
58
|
onSelect,
|
|
56
59
|
onPositionChange,
|
|
57
60
|
onSizeChange,
|
|
@@ -20,6 +20,8 @@ interface UseEditorHistoryReturn {
|
|
|
20
20
|
updateWithHistory: (updates: Partial<VideoProject>, action: string) => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const MAX_HISTORY_SIZE = 50;
|
|
24
|
+
|
|
23
25
|
export function useEditorHistory({
|
|
24
26
|
project,
|
|
25
27
|
onUpdateProject,
|
|
@@ -30,9 +32,10 @@ export function useEditorHistory({
|
|
|
30
32
|
const updateWithHistory = useCallback(
|
|
31
33
|
(updates: Partial<VideoProject>, _action: string) => {
|
|
32
34
|
if (project) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
setHistory((prev) => {
|
|
36
|
+
const next = [...prev, project];
|
|
37
|
+
return next.length > MAX_HISTORY_SIZE ? next.slice(-MAX_HISTORY_SIZE) : next;
|
|
38
|
+
});
|
|
36
39
|
setFuture([]);
|
|
37
40
|
|
|
38
41
|
onUpdateProject(updates);
|
|
@@ -58,12 +58,20 @@ export function useExport(config: UseExportConfig): UseExportReturn {
|
|
|
58
58
|
setIsExporting(true);
|
|
59
59
|
setExportProgress(null);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
try {
|
|
62
|
+
const result = await config.exportFunction(project, settings, (progress) => {
|
|
63
|
+
setExportProgress(progress);
|
|
64
|
+
});
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
return result;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return {
|
|
69
|
+
success: false,
|
|
70
|
+
error: error instanceof Error ? error.message : String(error),
|
|
71
|
+
};
|
|
72
|
+
} finally {
|
|
73
|
+
setIsExporting(false);
|
|
74
|
+
}
|
|
67
75
|
},
|
|
68
76
|
[config],
|
|
69
77
|
);
|