@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versa_ai/vmml-editor",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "module": "dist/index.mjs",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",
@@ -308,7 +308,7 @@
308
308
  }
309
309
  }
310
310
  .player-controls-time {
311
- width: 6vw !important;
311
+ width: 60px !important;
312
312
  }
313
313
  }
314
314
  }
@@ -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
- imgData.on('modified', () => {
338
- const fObj = convertToJSON(imgData);
339
- if (fObj.clipData.isAiError) {
340
- fObj.clipData.textColor = 'rgba(0, 0, 0, 0)';
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
@@ -287,7 +287,7 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
287
287
  if (clip.videoClip) {
288
288
  current.createImageFromClip(clip);
289
289
  } else {
290
- current.createTextFromClip(clip);
290
+ if (!clip.audioClip) current.createTextFromClip(clip);
291
291
  }
292
292
  })
293
293
  }
@@ -27,7 +27,6 @@ class VmmlConverter {
27
27
 
28
28
  //更新位置
29
29
  private setPosParam(fObj: any): object {
30
- console.log("setPosParam fObj",fObj)
31
30
  const {
32
31
  clipData: { type },
33
32
  centerPoint,