@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @versa_ai/vmml-editor@1.0.39 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.40 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,7 +9,6 @@
9
9
  CLI Target: node16
10
10
  CJS Build start
11
11
  ESM Build start
12
- DTS Build start
13
12
 
14
13
   WARN  ▲ [WARNING] Using / 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 [35
124
123
 
125
124
 
126
125
 
127
- CJS dist\index.js 122.27 KB
128
- CJS dist\index.js.map 233.66 KB
129
- CJS ⚡️ Build success in 839ms
130
- ESM dist\index.mjs 120.58 KB
131
- ESM dist\index.mjs.map 233.36 KB
132
- ESM ⚡️ Build success in 839ms
133
- DTS ⚡️ Build success in 2050ms
126
+ DTS Build start
127
+ ESM dist\index.mjs 120.82 KB
128
+ ESM dist\index.mjs.map 234.06 KB
129
+ ESM ⚡️ Build success in 753ms
130
+ CJS dist\index.js 122.51 KB
131
+ CJS dist\index.js.map 234.35 KB
132
+ CJS ⚡️ Build success in 754ms
133
+ DTS ⚡️ Build success in 2765ms
134
134
  DTS dist\index.d.ts 158.00 B
135
135
  DTS dist\index.d.mts 158.00 B
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
- existClip = originClip;
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
- originClip.duration = 0;
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
- console.log("deleteClip \u6700\u7EC8Vmml", this.vmml);
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 && !vmmlConverterRef.current) {
1766
- vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
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(() => {