@versa_ai/vmml-editor 1.0.27 → 1.0.29

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.27",
3
+ "version": "1.0.29",
4
4
  "module": "dist/index.mjs",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",
package/src/index.tsx CHANGED
@@ -435,23 +435,32 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
435
435
 
436
436
  const currentFrame = checkFrame ?? pauseFrame
437
437
 
438
- const convertedVmml = convertVmmlTextScaleByForbidden(v);
439
- setVmmlState(convertedVmml);
440
- setDurationInFrames(getFrames(v?.template?.duration || 1, fps));
441
-
442
- playerCurrent.setVmml(convertedVmml, currentFrame);
443
-
444
- setRefreshEdit(Date.now());
445
-
446
- if (canvasCurrent) {
447
- canvasCurrent.checkObjectInPoint(currentFrame);
448
- }
438
+ requestAnimationFrame(() => {
439
+ const convertedVmml = convertVmmlTextScaleByForbidden(v);
440
+ setVmmlState(convertedVmml);
441
+ setDurationInFrames(getFrames(v?.template?.duration || 1, fps));
442
+
443
+ playerCurrent.setVmml(convertedVmml, currentFrame);
444
+
445
+ setRefreshEdit(Date.now());
446
+
447
+ if (canvasCurrent) {
448
+ canvasCurrent.checkObjectInPoint(currentFrame);
449
+ }
450
+ })
449
451
  }
450
452
 
451
453
  const getCurrentFrame = () => {
452
- console.log(player, 'getCurrentFrame>>>>>>>>>>>>')
453
454
  if (!player) return 0
454
- return player.getPlayer().getCurrentFrame()
455
+ return player.getCurrentFrame()
456
+ }
457
+
458
+ const EditorSeekTo = (frame: number) => {
459
+ player?.seekTo?.(frame ?? 0)
460
+ const { current: canvasCurrent }: any = canvasRef;
461
+ if (canvasCurrent) {
462
+ canvasCurrent.checkObjectInPoint(frame);
463
+ }
455
464
  }
456
465
 
457
466
  useImperativeHandle(ref,
@@ -460,6 +469,7 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
460
469
  getfcObject,
461
470
  getCurrentFrame,
462
471
  getVmml,
472
+ EditorSeekTo,
463
473
  getPlayer,
464
474
  texteditClose,
465
475
  textFinish,