@versa_ai/vmml-editor 1.0.33 → 1.0.34

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
@@ -1053,6 +1053,7 @@ var EditorCanvas = forwardRef(
1053
1053
  if (fc) {
1054
1054
  const ns = Math.floor((f ?? frame) / 30 * 1e6);
1055
1055
  const objects = fc.getObjects();
1056
+ console.log(objects, "checkObjectInPoint>>>objects>>>>>>>>>>>", ns, f, frame);
1056
1057
  objects.forEach((item) => {
1057
1058
  var _a, _b, _c;
1058
1059
  if (((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u6587\u5B57") {
@@ -2772,24 +2773,24 @@ var EditorFn = ({
2772
2773
  }
2773
2774
  }, [dragState]);
2774
2775
  const updateEditor = (v, checkFrame) => {
2775
- var _a2, _b, _c, _d;
2776
+ var _a2, _b, _c, _d, _e;
2776
2777
  const { current: playerCurrent } = vmmlPlayerRef;
2777
2778
  const { current: canvasCurrent } = canvasRef;
2778
2779
  if (!playerCurrent) return;
2779
- const isSame = JSON.stringify(v) === JSON.stringify(vmmlState);
2780
- console.log(v, vmmlState, isSame, "\u5224\u65ADvmml\u662F\u5426\u76F8\u540C");
2781
2780
  needPlay.current = false;
2782
2781
  once.current = false;
2783
2782
  const convertedVmml = convertVmmlTextScaleByForbidden(v);
2783
+ const isSame = JSON.stringify(convertedVmml) === JSON.stringify(vmmlState);
2784
+ const currentFrame = checkFrame ?? (((_a2 = player == null ? void 0 : player.getCurrentFrame) == null ? void 0 : _a2.call(player)) ?? frame ?? pauseFrame);
2785
+ setFrame(currentFrame);
2786
+ playerCurrent.setVmml(convertedVmml, currentFrame);
2784
2787
  if (!isSame) {
2785
- (_b = (_a2 = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _a2.clear) == null ? void 0 : _b.call(_a2);
2788
+ (_c = (_b = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _b.clear) == null ? void 0 : _c.call(_b);
2786
2789
  setVmmlState(convertedVmml);
2787
- setDurationInFrames(getFrames(((_c = v == null ? void 0 : v.template) == null ? void 0 : _c.duration) || 1, fps));
2788
- setRefreshEdit(Date.now());
2790
+ setDurationInFrames(getFrames(((_d = convertedVmml == null ? void 0 : convertedVmml.template) == null ? void 0 : _d.duration) || 1, fps));
2791
+ } else {
2792
+ (_e = canvasCurrent == null ? void 0 : canvasCurrent.checkObjectInPoint) == null ? void 0 : _e.call(canvasCurrent, currentFrame);
2789
2793
  }
2790
- const currentFrame = checkFrame ?? pauseFrame;
2791
- playerCurrent.setVmml(convertedVmml, currentFrame);
2792
- (_d = canvasCurrent == null ? void 0 : canvasCurrent.checkObjectInPoint) == null ? void 0 : _d.call(canvasCurrent, currentFrame);
2793
2794
  };
2794
2795
  const getCurrentFrame = () => {
2795
2796
  if (!player) return 0;
@@ -2798,6 +2799,7 @@ var EditorFn = ({
2798
2799
  const editorSeekTo = (frame2) => {
2799
2800
  var _a2;
2800
2801
  (_a2 = player == null ? void 0 : player.seekTo) == null ? void 0 : _a2.call(player, frame2 ?? 0);
2802
+ setFrame(frame2 ?? 0);
2801
2803
  const { current: canvasCurrent } = canvasRef;
2802
2804
  if (canvasCurrent) {
2803
2805
  canvasCurrent.checkObjectInPoint(frame2);