@versa_ai/vmml-editor 1.0.28 → 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/dist/index.mjs CHANGED
@@ -2761,27 +2761,37 @@ var EditorFn = ({
2761
2761
  }
2762
2762
  }, [dragState]);
2763
2763
  const updateVmml = (v, checkFrame) => {
2764
- var _a2, _b, _c;
2764
+ var _a2, _b;
2765
2765
  const { current: playerCurrent } = vmmlPlayerRef;
2766
2766
  const { current: canvasCurrent } = canvasRef;
2767
2767
  if (!playerCurrent) return;
2768
2768
  (_b = (_a2 = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _a2.clear) == null ? void 0 : _b.call(_a2);
2769
2769
  needPlay.current = false;
2770
2770
  const currentFrame = checkFrame ?? pauseFrame;
2771
- const convertedVmml = convertVmmlTextScaleByForbidden(v);
2772
- setVmmlState(convertedVmml);
2773
- setDurationInFrames(getFrames(((_c = v == null ? void 0 : v.template) == null ? void 0 : _c.duration) || 1, fps));
2774
- playerCurrent.setVmml(convertedVmml, currentFrame);
2775
- setRefreshEdit(Date.now());
2776
- if (canvasCurrent) {
2777
- canvasCurrent.checkObjectInPoint(currentFrame);
2778
- }
2771
+ requestAnimationFrame(() => {
2772
+ var _a3;
2773
+ const convertedVmml = convertVmmlTextScaleByForbidden(v);
2774
+ setVmmlState(convertedVmml);
2775
+ setDurationInFrames(getFrames(((_a3 = v == null ? void 0 : v.template) == null ? void 0 : _a3.duration) || 1, fps));
2776
+ playerCurrent.setVmml(convertedVmml, currentFrame);
2777
+ setRefreshEdit(Date.now());
2778
+ if (canvasCurrent) {
2779
+ canvasCurrent.checkObjectInPoint(currentFrame);
2780
+ }
2781
+ });
2779
2782
  };
2780
2783
  const getCurrentFrame = () => {
2781
- console.log(player, "getCurrentFrame>>>>>>>>>>>>");
2782
2784
  if (!player) return 0;
2783
2785
  return player.getCurrentFrame();
2784
2786
  };
2787
+ const EditorSeekTo = (frame2) => {
2788
+ var _a2;
2789
+ (_a2 = player == null ? void 0 : player.seekTo) == null ? void 0 : _a2.call(player, frame2 ?? 0);
2790
+ const { current: canvasCurrent } = canvasRef;
2791
+ if (canvasCurrent) {
2792
+ canvasCurrent.checkObjectInPoint(frame2);
2793
+ }
2794
+ };
2785
2795
  useImperativeHandle(
2786
2796
  ref,
2787
2797
  () => ({
@@ -2789,6 +2799,7 @@ var EditorFn = ({
2789
2799
  getfcObject,
2790
2800
  getCurrentFrame,
2791
2801
  getVmml,
2802
+ EditorSeekTo,
2792
2803
  getPlayer,
2793
2804
  texteditClose,
2794
2805
  textFinish,