@versa_ai/vmml-editor 1.0.32 → 1.0.34
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 +33 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +37 -11
- package/src/index.tsx +12 -19
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.34 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
|
|
|
@@ -123,13 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[32mDTS[39m ⚡️ Build success in 1918ms
|
|
127
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m114.84 KB[39m
|
|
128
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m222.06 KB[39m
|
|
129
|
+
[32mESM[39m ⚡️ Build success in 3042ms
|
|
130
|
+
[32mCJS[39m [1mdist\index.js [22m[32m116.45 KB[39m
|
|
131
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m222.35 KB[39m
|
|
132
|
+
[32mCJS[39m ⚡️ Build success in 3042ms
|
|
133
|
+
[32mDTS[39m ⚡️ Build success in 1673ms
|
|
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
|
@@ -1055,6 +1055,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1055
1055
|
if (fc) {
|
|
1056
1056
|
const ns = Math.floor((f ?? frame) / 30 * 1e6);
|
|
1057
1057
|
const objects = fc.getObjects();
|
|
1058
|
+
console.log(objects, "checkObjectInPoint>>>objects>>>>>>>>>>>", ns, f, frame);
|
|
1058
1059
|
objects.forEach((item) => {
|
|
1059
1060
|
var _a, _b, _c;
|
|
1060
1061
|
if (((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u6587\u5B57") {
|
|
@@ -1441,6 +1442,25 @@ var EditorCanvas = react.forwardRef(
|
|
|
1441
1442
|
return null;
|
|
1442
1443
|
}
|
|
1443
1444
|
};
|
|
1445
|
+
const setTextAlign = (p, stroke, direction) => {
|
|
1446
|
+
if (direction === "center") {
|
|
1447
|
+
p.style.justifyContent = "center";
|
|
1448
|
+
stroke.style.left = "50%";
|
|
1449
|
+
stroke.style.top = "50%";
|
|
1450
|
+
stroke.style.transform = "translate(-50%, -50%)";
|
|
1451
|
+
}
|
|
1452
|
+
if (direction === "left") {
|
|
1453
|
+
stroke.style.left = "0";
|
|
1454
|
+
stroke.style.top = "0";
|
|
1455
|
+
stroke.style.transform = "none";
|
|
1456
|
+
}
|
|
1457
|
+
if (direction === "right") {
|
|
1458
|
+
p.style.justifyContent = "flex-end";
|
|
1459
|
+
stroke.style.right = "0";
|
|
1460
|
+
stroke.style.top = "50%";
|
|
1461
|
+
stroke.style.transform = "translateY(-50%)";
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1444
1464
|
const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo, letterSpacing }) => {
|
|
1445
1465
|
const fontBase64 = await loadFont(fontAssetUrl);
|
|
1446
1466
|
const container = document.createElement("div");
|
|
@@ -1462,7 +1482,6 @@ var EditorCanvas = react.forwardRef(
|
|
|
1462
1482
|
p.style.padding = "0";
|
|
1463
1483
|
if (letterSpacing) p.style.letterSpacing = `${letterSpacing}px`;
|
|
1464
1484
|
p.style.zIndex = "2";
|
|
1465
|
-
if (textWarapCenter) p.style.justifyContent = "center";
|
|
1466
1485
|
const fill = document.createElement("span");
|
|
1467
1486
|
fill.textContent = line || " ";
|
|
1468
1487
|
fill.style.color = textColor;
|
|
@@ -1474,15 +1493,9 @@ var EditorCanvas = react.forwardRef(
|
|
|
1474
1493
|
stroke.style.color = "transparent";
|
|
1475
1494
|
stroke.style.webkitTextStrokeWidth = `${strokeW}px`;
|
|
1476
1495
|
stroke.style.webkitTextStrokeColor = stColor;
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
stroke.style.transform = "translate(-50%, -50%)";
|
|
1481
|
-
} else {
|
|
1482
|
-
stroke.style.left = "0";
|
|
1483
|
-
stroke.style.top = "0";
|
|
1484
|
-
}
|
|
1485
|
-
stroke.style.zIndex = "-1";
|
|
1496
|
+
let dr = textBasicInfo.textAlign || "left";
|
|
1497
|
+
if (textWarapCenter) dr = "center";
|
|
1498
|
+
setTextAlign(p, stroke, dr);
|
|
1486
1499
|
p.appendChild(fill);
|
|
1487
1500
|
p.appendChild(stroke);
|
|
1488
1501
|
container.appendChild(p);
|
|
@@ -2762,24 +2775,24 @@ var EditorFn = ({
|
|
|
2762
2775
|
}
|
|
2763
2776
|
}, [dragState]);
|
|
2764
2777
|
const updateEditor = (v, checkFrame) => {
|
|
2765
|
-
var _a2, _b, _c, _d;
|
|
2778
|
+
var _a2, _b, _c, _d, _e;
|
|
2766
2779
|
const { current: playerCurrent } = vmmlPlayerRef;
|
|
2767
2780
|
const { current: canvasCurrent } = canvasRef;
|
|
2768
2781
|
if (!playerCurrent) return;
|
|
2769
|
-
const isSame = JSON.stringify(v) === JSON.stringify(vmmlState);
|
|
2770
|
-
console.log(v, vmmlState, isSame, "\u5224\u65ADvmml\u662F\u5426\u76F8\u540C");
|
|
2771
2782
|
needPlay.current = false;
|
|
2772
2783
|
once.current = false;
|
|
2773
2784
|
const convertedVmml = vmmlUtils.convertVmmlTextScaleByForbidden(v);
|
|
2785
|
+
const isSame = JSON.stringify(convertedVmml) === JSON.stringify(vmmlState);
|
|
2786
|
+
const currentFrame = checkFrame ?? (((_a2 = player == null ? void 0 : player.getCurrentFrame) == null ? void 0 : _a2.call(player)) ?? frame ?? pauseFrame);
|
|
2787
|
+
setFrame(currentFrame);
|
|
2788
|
+
playerCurrent.setVmml(convertedVmml, currentFrame);
|
|
2774
2789
|
if (!isSame) {
|
|
2775
|
-
(
|
|
2790
|
+
(_c = (_b = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _b.clear) == null ? void 0 : _c.call(_b);
|
|
2776
2791
|
setVmmlState(convertedVmml);
|
|
2777
|
-
setDurationInFrames(vmmlUtils.getFrames(((
|
|
2778
|
-
|
|
2792
|
+
setDurationInFrames(vmmlUtils.getFrames(((_d = convertedVmml == null ? void 0 : convertedVmml.template) == null ? void 0 : _d.duration) || 1, fps));
|
|
2793
|
+
} else {
|
|
2794
|
+
(_e = canvasCurrent == null ? void 0 : canvasCurrent.checkObjectInPoint) == null ? void 0 : _e.call(canvasCurrent, currentFrame);
|
|
2779
2795
|
}
|
|
2780
|
-
const currentFrame = checkFrame ?? pauseFrame;
|
|
2781
|
-
playerCurrent.setVmml(convertedVmml, currentFrame);
|
|
2782
|
-
(_d = canvasCurrent == null ? void 0 : canvasCurrent.checkObjectInPoint) == null ? void 0 : _d.call(canvasCurrent, currentFrame);
|
|
2783
2796
|
};
|
|
2784
2797
|
const getCurrentFrame = () => {
|
|
2785
2798
|
if (!player) return 0;
|
|
@@ -2788,6 +2801,7 @@ var EditorFn = ({
|
|
|
2788
2801
|
const editorSeekTo = (frame2) => {
|
|
2789
2802
|
var _a2;
|
|
2790
2803
|
(_a2 = player == null ? void 0 : player.seekTo) == null ? void 0 : _a2.call(player, frame2 ?? 0);
|
|
2804
|
+
setFrame(frame2 ?? 0);
|
|
2791
2805
|
const { current: canvasCurrent } = canvasRef;
|
|
2792
2806
|
if (canvasCurrent) {
|
|
2793
2807
|
canvasCurrent.checkObjectInPoint(frame2);
|