@versa_ai/vmml-editor 1.0.14 → 1.0.15
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 +30 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/css/index.scss +1 -1
- package/src/components/EditorCanvas.tsx +33 -6
- package/src/index.tsx +1 -1
- package/src/utils/VmmlConverter.ts +0 -1
package/package.json
CHANGED
|
@@ -272,6 +272,29 @@ const EditorCanvas = forwardRef(
|
|
|
272
272
|
history.undo();
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
+
const onBatchModify = (fObj: any, canvas: any) => {
|
|
276
|
+
console.log('onBatchModify>>>>>>>>>>>>>>>>>>>>>>>>')
|
|
277
|
+
if (!canvas) return;
|
|
278
|
+
const textObjects = canvas.getObjects().filter((item: any) => item?.clipData?.type === "文字");
|
|
279
|
+
const { left, top, scaleX, scaleY, angle } = fObj;
|
|
280
|
+
|
|
281
|
+
// 批量更新每个文字对象的位置
|
|
282
|
+
textObjects.forEach((textObj: any) => {
|
|
283
|
+
textObj.set({
|
|
284
|
+
left,
|
|
285
|
+
top,
|
|
286
|
+
scaleX,
|
|
287
|
+
scaleY,
|
|
288
|
+
angle
|
|
289
|
+
});
|
|
290
|
+
textObj.setCoords();
|
|
291
|
+
const updatedFObj = convertToJSON(textObj);
|
|
292
|
+
vmmlConverterRef.current.updateClip(updatedFObj);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
canvas.renderAll();
|
|
296
|
+
}
|
|
297
|
+
|
|
275
298
|
// 创建可编辑的textclip
|
|
276
299
|
const createTextFromClip = async (clip: any, fc2: any) => {
|
|
277
300
|
const canvas = fc || fc2;
|
|
@@ -334,13 +357,17 @@ const EditorCanvas = forwardRef(
|
|
|
334
357
|
imgData.on("moving", (options: any) => {
|
|
335
358
|
options.transform.target.isSelected = 0;
|
|
336
359
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
360
|
+
imgData.on('modified', () => {
|
|
361
|
+
const fObj = convertToJSON(imgData);
|
|
362
|
+
if (fObj.clipData.isAiError) {
|
|
363
|
+
fObj.clipData.textColor = 'rgba(0, 0, 0, 0)';
|
|
364
|
+
}
|
|
365
|
+
if (isBatchModify) {
|
|
366
|
+
onBatchModify(fObj, canvas)
|
|
367
|
+
} else {
|
|
342
368
|
vmmlConverterRef.current.updateClip(fObj);
|
|
343
|
-
}
|
|
369
|
+
}
|
|
370
|
+
});
|
|
344
371
|
canvas.add(imgData).renderAll();
|
|
345
372
|
})
|
|
346
373
|
} else {
|
package/src/index.tsx
CHANGED