@versa_ai/vmml-editor 1.0.55 → 1.0.57
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/.turbo/turbo-build.log +9 -9
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/EditorCanvas.tsx +44 -13
- package/src/index.tsx +22 -15
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @versa_ai/vmml-editor@1.0.
|
|
2
|
+
> @versa_ai/vmml-editor@1.0.57 build D:\code\work\vmml-player\packages\editor
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
[34mCLI[39m Target: node16
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
+
[34mDTS[39m Build start
|
|
12
13
|
|
|
13
14
|
[43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUsing / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
|
|
14
15
|
|
|
@@ -66,7 +67,6 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
|
|
69
|
-
[34mDTS[39m Build start
|
|
70
70
|
|
|
71
71
|
[43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUsing / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
|
|
72
72
|
|
|
@@ -124,12 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
128
|
-
[32mCJS[39m [1mdist\index.js.map [22m[
|
|
129
|
-
[32mCJS[39m ⚡️ Build success in
|
|
130
|
-
[32mESM[39m [1mdist\index.mjs [22m[
|
|
131
|
-
[32mESM[39m [1mdist\index.mjs.map [22m[
|
|
132
|
-
[32mESM[39m ⚡️ Build success in
|
|
133
|
-
[32mDTS[39m ⚡️ Build success in
|
|
127
|
+
[32mCJS[39m [1mdist\index.js [22m[32m123.55 KB[39m
|
|
128
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m237.48 KB[39m
|
|
129
|
+
[32mCJS[39m ⚡️ Build success in 779ms
|
|
130
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m121.66 KB[39m
|
|
131
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m237.17 KB[39m
|
|
132
|
+
[32mESM[39m ⚡️ Build success in 780ms
|
|
133
|
+
[32mDTS[39m ⚡️ Build success in 1976ms
|
|
134
134
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m158.00 B[39m
|
|
135
135
|
[32mDTS[39m [1mdist\index.d.mts [22m[32m158.00 B[39m
|
package/dist/index.js
CHANGED
|
@@ -1033,7 +1033,7 @@ function usePeekControl(canvas, hideConfig) {
|
|
|
1033
1033
|
return canvas;
|
|
1034
1034
|
}
|
|
1035
1035
|
var EditorCanvas = react.forwardRef(
|
|
1036
|
-
({ previewState, showCanvas, canvasSize, enterPreview, intoTextEdit, frame, vmml, dragState, initFcObjs, editClips = [], onVideoChange, isBatchModify, hideConfig, textWarapCenter, updateVmml }, ref) => {
|
|
1036
|
+
({ lockInBounds, previewState, showCanvas, canvasSize, enterPreview, intoTextEdit, frame, vmml, dragState, initFcObjs, editClips = [], onVideoChange, isBatchModify, hideConfig, textWarapCenter, updateVmml }, ref) => {
|
|
1037
1037
|
const [fc, setFc] = react.useState(null);
|
|
1038
1038
|
const [history, setHistory] = react.useState(null);
|
|
1039
1039
|
const [canvasReady, setCanvasReady] = react.useState(false);
|
|
@@ -1043,6 +1043,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1043
1043
|
const heightScaleRef = react.useRef(1);
|
|
1044
1044
|
const widthScaleRef = react.useRef(1);
|
|
1045
1045
|
const fontCacheRef = react.useRef(/* @__PURE__ */ new Map());
|
|
1046
|
+
const lockInBoundsRef = react.useRef(lockInBounds);
|
|
1046
1047
|
const initCanvas = () => {
|
|
1047
1048
|
const canvas = new fabric.fabric.Canvas("canvas", {
|
|
1048
1049
|
width: canvasSize.width,
|
|
@@ -1114,9 +1115,27 @@ var EditorCanvas = react.forwardRef(
|
|
|
1114
1115
|
vmmlConverterRef.current.changeMute(clipData);
|
|
1115
1116
|
});
|
|
1116
1117
|
canvas.on("object:textEdit", (e) => {
|
|
1118
|
+
console.log("1111111111");
|
|
1117
1119
|
const active = canvas.getActiveObject();
|
|
1118
1120
|
handleIntoTextMenu(active, canvas);
|
|
1119
1121
|
});
|
|
1122
|
+
canvas.on("object:moving", (e) => {
|
|
1123
|
+
if (!lockInBoundsRef.current) return;
|
|
1124
|
+
const obj = e.target;
|
|
1125
|
+
const canvasWidth = canvas.getWidth();
|
|
1126
|
+
const canvasHeight = canvas.getHeight();
|
|
1127
|
+
let left = obj.left;
|
|
1128
|
+
let top = obj.top;
|
|
1129
|
+
let w = obj.width;
|
|
1130
|
+
let h = obj.height;
|
|
1131
|
+
const paddingX = 15;
|
|
1132
|
+
const paddingY = 10;
|
|
1133
|
+
if (left <= w / 2 - paddingX) left = w / 2 - paddingX;
|
|
1134
|
+
if (left >= canvasWidth - (w / 2 - paddingX - 2.5)) left = canvasWidth - (w / 2 - paddingX - 2.5);
|
|
1135
|
+
if (top <= (h - paddingY) / 2) top = (h - paddingY) / 2;
|
|
1136
|
+
if (top >= canvasHeight - (h - paddingY) / 2) top = canvasHeight - (h - paddingY) / 2;
|
|
1137
|
+
obj.set({ left, top }).setCoords();
|
|
1138
|
+
});
|
|
1120
1139
|
};
|
|
1121
1140
|
const imitateDBclick = (active, canvas) => {
|
|
1122
1141
|
active.isSelected++;
|
|
@@ -1278,7 +1297,9 @@ var EditorCanvas = react.forwardRef(
|
|
|
1278
1297
|
top,
|
|
1279
1298
|
angle: posParam.rotationZ,
|
|
1280
1299
|
originX: "center",
|
|
1300
|
+
// 圆点:中心点
|
|
1281
1301
|
originY: "center",
|
|
1302
|
+
// 圆点:中心点
|
|
1282
1303
|
clipData: {
|
|
1283
1304
|
id: clip.id,
|
|
1284
1305
|
isMute: null,
|
|
@@ -1712,6 +1733,9 @@ var EditorCanvas = react.forwardRef(
|
|
|
1712
1733
|
}
|
|
1713
1734
|
}
|
|
1714
1735
|
}, [fc]);
|
|
1736
|
+
react.useEffect(() => {
|
|
1737
|
+
lockInBoundsRef.current = lockInBounds;
|
|
1738
|
+
}, [lockInBounds]);
|
|
1715
1739
|
const getCanvasCtx = () => {
|
|
1716
1740
|
return fc;
|
|
1717
1741
|
};
|
|
@@ -2500,6 +2524,7 @@ var EditorFn = ({
|
|
|
2500
2524
|
maxText = 10,
|
|
2501
2525
|
maxVideo = 5,
|
|
2502
2526
|
videoMenus = [],
|
|
2527
|
+
controls = true,
|
|
2503
2528
|
onMenuChange,
|
|
2504
2529
|
showTextButtons = false,
|
|
2505
2530
|
editableArray = [],
|
|
@@ -2511,6 +2536,7 @@ var EditorFn = ({
|
|
|
2511
2536
|
textWarapCenter = false,
|
|
2512
2537
|
backgroundColor = "#000",
|
|
2513
2538
|
existenceBorderRadio = true,
|
|
2539
|
+
lockInBounds = false,
|
|
2514
2540
|
hideConfig = { hideDelete: false, hideEdit: false, hideMute: false, hideVolume: false }
|
|
2515
2541
|
// { hideDelete: false, hideEdit: false, hideMute: false, hideVolume: false }
|
|
2516
2542
|
}, ref) => {
|
|
@@ -3005,6 +3031,7 @@ var EditorFn = ({
|
|
|
3005
3031
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3006
3032
|
EditorCanvas_default,
|
|
3007
3033
|
{
|
|
3034
|
+
lockInBounds,
|
|
3008
3035
|
ref: canvasRef,
|
|
3009
3036
|
previewState,
|
|
3010
3037
|
showCanvas,
|
|
@@ -3025,7 +3052,7 @@ var EditorFn = ({
|
|
|
3025
3052
|
),
|
|
3026
3053
|
/* @__PURE__ */ jsxRuntime.jsx(Loading_default, { show: loading })
|
|
3027
3054
|
] }) }),
|
|
3028
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "controls-box", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3055
|
+
controls && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "controls-box", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3029
3056
|
Controls_default,
|
|
3030
3057
|
{
|
|
3031
3058
|
backgroundColor,
|