@versa_ai/vmml-editor 1.0.39 → 1.0.40
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 +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +9 -7
- package/src/utils/VmmlConverter.ts +26 -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.40 build D:\code\work\vmml-player\packages\editor
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
[34mCLI[39m Target: node16
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[34mDTS[39m Build start
|
|
13
12
|
|
|
14
13
|
[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.
|
|
15
14
|
|
|
@@ -124,12 +123,13 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
124
123
|
|
|
125
124
|
|
|
126
125
|
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[32mESM[39m
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
126
|
+
[34mDTS[39m Build start
|
|
127
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m120.82 KB[39m
|
|
128
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m234.06 KB[39m
|
|
129
|
+
[32mESM[39m ⚡️ Build success in 753ms
|
|
130
|
+
[32mCJS[39m [1mdist\index.js [22m[32m122.51 KB[39m
|
|
131
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m234.35 KB[39m
|
|
132
|
+
[32mCJS[39m ⚡️ Build success in 754ms
|
|
133
|
+
[32mDTS[39m ⚡️ Build success in 2765ms
|
|
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
|
@@ -709,15 +709,20 @@ var VmmlConverter = class {
|
|
|
709
709
|
* @param fObj - 画布fObj
|
|
710
710
|
*/
|
|
711
711
|
updateClip(fObj) {
|
|
712
|
-
console.log("updateClip fObj", fObj);
|
|
712
|
+
console.log("updateClip fObj", fObj, this.tracks);
|
|
713
713
|
const posParam = this.setPosParam(fObj);
|
|
714
714
|
const {
|
|
715
|
-
// clipData: { id, type, lineSpacing },
|
|
716
715
|
clipData: { id, type, lineSpacing, originClip }
|
|
717
716
|
} = fObj;
|
|
718
717
|
let existClip = null;
|
|
719
718
|
if (originClip) {
|
|
720
|
-
|
|
719
|
+
for (const track of this.tracks) {
|
|
720
|
+
const clip = (track.clips || []).find((c) => c.id === originClip.id);
|
|
721
|
+
if (clip) {
|
|
722
|
+
existClip = clip;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
721
726
|
} else {
|
|
722
727
|
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
723
728
|
existClip = ((editorTrack == null ? void 0 : editorTrack.clips) || []).find((clip) => clip.id === id);
|
|
@@ -742,7 +747,6 @@ var VmmlConverter = class {
|
|
|
742
747
|
};
|
|
743
748
|
}
|
|
744
749
|
}
|
|
745
|
-
console.log("updateClip \u6700\u7EC8vmml", this.vmml);
|
|
746
750
|
}
|
|
747
751
|
/**
|
|
748
752
|
* 删除 Clip
|
|
@@ -751,7 +755,13 @@ var VmmlConverter = class {
|
|
|
751
755
|
*/
|
|
752
756
|
deleteClip({ id, type, originClip }) {
|
|
753
757
|
if (originClip) {
|
|
754
|
-
|
|
758
|
+
for (const track of this.tracks) {
|
|
759
|
+
const clip = (track.clips || []).find((c) => c.id === originClip.id);
|
|
760
|
+
if (clip) {
|
|
761
|
+
clip.duration = 0;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
755
765
|
} else {
|
|
756
766
|
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
757
767
|
const index = editorTrack.clips.findIndex((item) => item.id === id);
|
|
@@ -769,7 +779,9 @@ var VmmlConverter = class {
|
|
|
769
779
|
}
|
|
770
780
|
}
|
|
771
781
|
}
|
|
772
|
-
|
|
782
|
+
}
|
|
783
|
+
changeVmml(newVmml) {
|
|
784
|
+
this.vmml = newVmml;
|
|
773
785
|
}
|
|
774
786
|
//切换静音 视频/音频
|
|
775
787
|
changeMute({ id, isMute }) {
|
|
@@ -1056,13 +1068,12 @@ var EditorCanvas = react.forwardRef(
|
|
|
1056
1068
|
if (fc) {
|
|
1057
1069
|
const ns = Math.floor((f ?? frame) / 30 * 1e6);
|
|
1058
1070
|
const objects = fc.getObjects();
|
|
1059
|
-
console.log(objects, "fc>>>>>>>>>>>>>>>>", frame);
|
|
1060
1071
|
objects.forEach((item) => {
|
|
1061
1072
|
var _a, _b, _c;
|
|
1062
1073
|
if (((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u6587\u5B57") {
|
|
1063
|
-
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + (item.clipData.duration || vmml.template.duration));
|
|
1074
|
+
item.set("visible", item.clipData.duration > 0 && ns >= item.clipData.inPoint && ns < item.clipData.inPoint + (item.clipData.duration || vmml.template.duration));
|
|
1064
1075
|
} else {
|
|
1065
|
-
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + ((_c = (_b = item.clipData) == null ? void 0 : _b.fileUrl) == null ? void 0 : _c.duration));
|
|
1076
|
+
item.set("visible", item.clipData.duration > 0 && ns >= item.clipData.inPoint && ns < item.clipData.inPoint + ((_c = (_b = item.clipData) == null ? void 0 : _b.fileUrl) == null ? void 0 : _c.duration));
|
|
1066
1077
|
}
|
|
1067
1078
|
});
|
|
1068
1079
|
fc.discardActiveObject();
|
|
@@ -1338,7 +1349,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1338
1349
|
await document.fonts.ready;
|
|
1339
1350
|
}
|
|
1340
1351
|
}
|
|
1341
|
-
const lines = textContent.split("\n");
|
|
1352
|
+
const lines = textContent.split("\n").filter((item) => item);
|
|
1342
1353
|
const lineHeight = 22 + strokeW;
|
|
1343
1354
|
const textHeight = lines.length * lineHeight;
|
|
1344
1355
|
const groupWidth = Math.max(...lines.map((l) => {
|
|
@@ -1762,8 +1773,10 @@ var EditorCanvas = react.forwardRef(
|
|
|
1762
1773
|
}
|
|
1763
1774
|
}, [fc, dragState]);
|
|
1764
1775
|
react.useEffect(() => {
|
|
1765
|
-
if (canvasSize.width && canvasSize.height
|
|
1766
|
-
vmmlConverterRef.current
|
|
1776
|
+
if (canvasSize.width && canvasSize.height) {
|
|
1777
|
+
if (vmmlConverterRef.current) ; else {
|
|
1778
|
+
vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
|
|
1779
|
+
}
|
|
1767
1780
|
}
|
|
1768
1781
|
}, [canvasSize, vmml]);
|
|
1769
1782
|
react.useEffect(() => {
|