@versa_ai/vmml-editor 1.0.16 → 1.0.17
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 +9 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +7 -13
- package/src/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -220,16 +220,6 @@ const EditorCanvas = forwardRef(
|
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
const createEditObjes = async (canvas: any, time: number) => {
|
|
223
|
-
// 先删除所有旧的可编辑对象
|
|
224
|
-
const allObjects = canvas.getObjects();
|
|
225
|
-
const toRemove: any[] = [];
|
|
226
|
-
allObjects.forEach((obj: any) => {
|
|
227
|
-
if (obj?.clipData?.originClip) {
|
|
228
|
-
toRemove.push(obj);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
toRemove.forEach(obj => canvas.remove(obj));
|
|
232
|
-
|
|
233
223
|
const promises = editClips.map((clip: any) => {
|
|
234
224
|
if (clip.videoClip) {
|
|
235
225
|
return createImageFromClip(clip);
|
|
@@ -571,7 +561,6 @@ const EditorCanvas = forwardRef(
|
|
|
571
561
|
return fc.getObjects();
|
|
572
562
|
}
|
|
573
563
|
}
|
|
574
|
-
|
|
575
564
|
const styles: any = useMemo(() => {
|
|
576
565
|
return {
|
|
577
566
|
position: "absolute",
|
|
@@ -632,6 +621,10 @@ const EditorCanvas = forwardRef(
|
|
|
632
621
|
}
|
|
633
622
|
}, [fc]);
|
|
634
623
|
|
|
624
|
+
const getCanvasCtx = () => {
|
|
625
|
+
return fc
|
|
626
|
+
}
|
|
627
|
+
|
|
635
628
|
useImperativeHandle(ref, () => ({
|
|
636
629
|
createImage,
|
|
637
630
|
createText,
|
|
@@ -645,8 +638,9 @@ const EditorCanvas = forwardRef(
|
|
|
645
638
|
checkObjectInPoint,
|
|
646
639
|
createImageFromClip,
|
|
647
640
|
createTextFromClip,
|
|
648
|
-
changeObjectVisible
|
|
649
|
-
|
|
641
|
+
changeObjectVisible,
|
|
642
|
+
getCanvasCtx
|
|
643
|
+
}), [fc]);
|
|
650
644
|
|
|
651
645
|
const getActions = () => {
|
|
652
646
|
if (history) {
|
package/src/index.tsx
CHANGED
|
@@ -426,7 +426,8 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
|
|
|
426
426
|
const { current: playerCurrent }: any = vmmlPlayerRef;
|
|
427
427
|
const { current: canvasCurrent }: any = canvasRef;
|
|
428
428
|
if (!playerCurrent) return;
|
|
429
|
-
|
|
429
|
+
canvasCurrent?.getCanvasCtx()?.clear?.()
|
|
430
|
+
|
|
430
431
|
const convertedVmml = convertVmmlTextScaleByForbidden(v);
|
|
431
432
|
setVmmlState(convertedVmml);
|
|
432
433
|
setDurationInFrames(getFrames(v?.template?.duration || 1, fps));
|