@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.
- package/.turbo/turbo-build.log +9 -9
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +1 -1
- package/src/utils/VmmlConverter.ts +16 -13
package/dist/index.mjs
CHANGED
|
@@ -615,6 +615,20 @@ var VmmlConverter = class {
|
|
|
615
615
|
rotationY: _rotationY
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
|
+
findClip(id) {
|
|
619
|
+
const tracks = this.vmml.template.tracks || [];
|
|
620
|
+
const isString = typeof id === "string";
|
|
621
|
+
const ids = isString ? [id] : id;
|
|
622
|
+
const list = [];
|
|
623
|
+
tracks.forEach((track) => {
|
|
624
|
+
track.clips.forEach((clip) => {
|
|
625
|
+
if (ids == null ? void 0 : ids.includes(clip.id)) {
|
|
626
|
+
list.push(clip);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
return list;
|
|
631
|
+
}
|
|
618
632
|
/**
|
|
619
633
|
* 转换 TextClip
|
|
620
634
|
* @param fObj - 画布fObj
|
|
@@ -712,19 +726,7 @@ var VmmlConverter = class {
|
|
|
712
726
|
const {
|
|
713
727
|
clipData: { id, type, lineSpacing, originClip }
|
|
714
728
|
} = fObj;
|
|
715
|
-
|
|
716
|
-
if (originClip) {
|
|
717
|
-
for (const track of this.tracks) {
|
|
718
|
-
const clip = (track.clips || []).find((c) => c.id === originClip.id);
|
|
719
|
-
if (clip) {
|
|
720
|
-
existClip = clip;
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
} else {
|
|
725
|
-
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
726
|
-
existClip = ((editorTrack == null ? void 0 : editorTrack.clips) || []).find((clip) => clip.id === id);
|
|
727
|
-
}
|
|
729
|
+
const [existClip] = this.findClip(id);
|
|
728
730
|
if (existClip) {
|
|
729
731
|
!originClip && (existClip.fObj = fObj);
|
|
730
732
|
if (type === "\u8868\u60C5\u5305") {
|
|
@@ -1772,7 +1774,9 @@ var EditorCanvas = forwardRef(
|
|
|
1772
1774
|
}, [fc, dragState]);
|
|
1773
1775
|
useEffect(() => {
|
|
1774
1776
|
if (canvasSize.width && canvasSize.height) {
|
|
1775
|
-
if (vmmlConverterRef.current)
|
|
1777
|
+
if (vmmlConverterRef.current) {
|
|
1778
|
+
vmmlConverterRef.current.changeVmml(vmml);
|
|
1779
|
+
} else {
|
|
1776
1780
|
vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
|
|
1777
1781
|
}
|
|
1778
1782
|
}
|