@versa_ai/vmml-editor 1.0.40 → 1.0.41

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.40 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.41 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -66,6 +66,7 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
66
66
 
67
67
 
68
68
 
69
+ DTS Build start
69
70
 
70
71
   WARN  ▲ [WARNING] Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
71
72
 
@@ -123,13 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
123
124
 
124
125
 
125
126
 
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
127
+ CJS dist\index.js 122.59 KB
128
+ CJS dist\index.js.map 234.64 KB
129
+ CJS ⚡️ Build success in 868ms
130
+ ESM dist\index.mjs 120.90 KB
131
+ ESM dist\index.mjs.map 234.34 KB
132
+ ESM ⚡️ Build success in 868ms
133
+ DTS ⚡️ Build success in 1828ms
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
@@ -617,6 +617,20 @@ var VmmlConverter = class {
617
617
  rotationY: _rotationY
618
618
  };
619
619
  }
620
+ findClip(id) {
621
+ const tracks = this.vmml.template.tracks || [];
622
+ const isString = typeof id === "string";
623
+ const ids = isString ? [id] : id;
624
+ const list = [];
625
+ tracks.forEach((track) => {
626
+ track.clips.forEach((clip) => {
627
+ if (ids == null ? void 0 : ids.includes(clip.id)) {
628
+ list.push(clip);
629
+ }
630
+ });
631
+ });
632
+ return list;
633
+ }
620
634
  /**
621
635
  * 转换 TextClip
622
636
  * @param fObj - 画布fObj
@@ -714,19 +728,7 @@ var VmmlConverter = class {
714
728
  const {
715
729
  clipData: { id, type, lineSpacing, originClip }
716
730
  } = fObj;
717
- let existClip = null;
718
- if (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
- }
726
- } else {
727
- const editorTrack = this.tracks.find((track) => track.editorType === type);
728
- existClip = ((editorTrack == null ? void 0 : editorTrack.clips) || []).find((clip) => clip.id === id);
729
- }
731
+ const [existClip] = this.findClip(id);
730
732
  if (existClip) {
731
733
  !originClip && (existClip.fObj = fObj);
732
734
  if (type === "\u8868\u60C5\u5305") {
@@ -1774,7 +1776,9 @@ var EditorCanvas = react.forwardRef(
1774
1776
  }, [fc, dragState]);
1775
1777
  react.useEffect(() => {
1776
1778
  if (canvasSize.width && canvasSize.height) {
1777
- if (vmmlConverterRef.current) ; else {
1779
+ if (vmmlConverterRef.current) {
1780
+ vmmlConverterRef.current.changeVmml(vmml);
1781
+ } else {
1778
1782
  vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
1779
1783
  }
1780
1784
  }