@versa_ai/vmml-editor 1.0.28 → 1.0.30

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @versa_ai/vmml-editor@1.0.28 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.30 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -66,6 +66,7 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
66
66
 
67
67
 
68
68
 
69
+ DTS Build start
69
70
 
70
71
   WARN  ▲ [WARNING] Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
71
72
 
@@ -123,13 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
123
124
 
124
125
 
125
126
 
126
- DTS Build start
127
- ESM dist\index.mjs 113.87 KB
128
- ESM dist\index.mjs.map 218.82 KB
129
- ESM ⚡️ Build success in 666ms
130
- CJS dist\index.js 115.50 KB
131
- CJS dist\index.js.map 219.12 KB
132
- CJS ⚡️ Build success in 666ms
133
- DTS ⚡️ Build success in 1709ms
127
+ CJS dist\index.js 115.76 KB
128
+ CJS dist\index.js.map 220.37 KB
129
+ CJS ⚡️ Build success in 863ms
130
+ ESM dist\index.mjs 114.15 KB
131
+ ESM dist\index.mjs.map 220.08 KB
132
+ ESM ⚡️ Build success in 864ms
133
+ DTS ⚡️ Build success in 1631ms
134
134
  DTS dist\index.d.ts 158.00 B
135
135
  DTS dist\index.d.mts 158.00 B
Binary file
package/dist/index.js CHANGED
@@ -2706,15 +2706,6 @@ var EditorFn = ({
2706
2706
  initCanEditClips(vmmlState.template.tracks);
2707
2707
  }
2708
2708
  }, [editableArray, refreshEdit, vmmlState]);
2709
- react.useEffect(() => {
2710
- var _a2;
2711
- if (propVmml) {
2712
- const convertedVmml = vmmlUtils.convertVmmlTextScaleByForbidden(propVmml);
2713
- setVmmlState(convertedVmml);
2714
- setDurationInFrames(vmmlUtils.getFrames(((_a2 = propVmml == null ? void 0 : propVmml.template) == null ? void 0 : _a2.duration) || 1, fps));
2715
- setRefreshEdit(Date.now());
2716
- }
2717
- }, [propVmml]);
2718
2709
  react.useEffect(() => {
2719
2710
  if (vmmlState) {
2720
2711
  initFcObjects(vmmlState.template.tracks);
@@ -2762,39 +2753,56 @@ var EditorFn = ({
2762
2753
  setPreviewState(false);
2763
2754
  }
2764
2755
  }, [dragState]);
2765
- const updateVmml = (v, checkFrame) => {
2766
- var _a2, _b, _c;
2756
+ const updateEditor = (v, checkFrame) => {
2757
+ var _a2, _b, _c, _d;
2767
2758
  const { current: playerCurrent } = vmmlPlayerRef;
2768
2759
  const { current: canvasCurrent } = canvasRef;
2769
2760
  if (!playerCurrent) return;
2770
- (_b = (_a2 = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _a2.clear) == null ? void 0 : _b.call(_a2);
2761
+ const isSame = JSON.stringify(v) === JSON.stringify(vmmlState);
2762
+ console.log(v, vmmlState, isSame, "\u5224\u65ADvmml\u662F\u5426\u76F8\u540C");
2771
2763
  needPlay.current = false;
2772
- const currentFrame = checkFrame ?? pauseFrame;
2773
2764
  const convertedVmml = vmmlUtils.convertVmmlTextScaleByForbidden(v);
2774
- setVmmlState(convertedVmml);
2775
- setDurationInFrames(vmmlUtils.getFrames(((_c = v == null ? void 0 : v.template) == null ? void 0 : _c.duration) || 1, fps));
2776
- playerCurrent.setVmml(convertedVmml, currentFrame);
2777
- setRefreshEdit(Date.now());
2778
- if (canvasCurrent) {
2779
- canvasCurrent.checkObjectInPoint(currentFrame);
2765
+ if (!isSame) {
2766
+ (_b = (_a2 = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _a2.clear) == null ? void 0 : _b.call(_a2);
2767
+ setVmmlState(convertedVmml);
2768
+ setDurationInFrames(vmmlUtils.getFrames(((_c = v == null ? void 0 : v.template) == null ? void 0 : _c.duration) || 1, fps));
2769
+ setRefreshEdit(Date.now());
2780
2770
  }
2771
+ const currentFrame = checkFrame ?? pauseFrame;
2772
+ playerCurrent.setVmml(convertedVmml, currentFrame);
2773
+ (_d = canvasCurrent == null ? void 0 : canvasCurrent.checkObjectInPoint) == null ? void 0 : _d.call(canvasCurrent, currentFrame);
2781
2774
  };
2782
2775
  const getCurrentFrame = () => {
2783
- console.log(player, "getCurrentFrame>>>>>>>>>>>>");
2784
2776
  if (!player) return 0;
2785
2777
  return player.getCurrentFrame();
2786
2778
  };
2779
+ const editorSeekTo = (frame2) => {
2780
+ var _a2;
2781
+ (_a2 = player == null ? void 0 : player.seekTo) == null ? void 0 : _a2.call(player, frame2 ?? 0);
2782
+ const { current: canvasCurrent } = canvasRef;
2783
+ if (canvasCurrent) {
2784
+ canvasCurrent.checkObjectInPoint(frame2);
2785
+ }
2786
+ };
2787
2787
  react.useImperativeHandle(
2788
2788
  ref,
2789
2789
  () => ({
2790
2790
  getActions,
2791
2791
  getfcObject,
2792
+ // 获取画布上所有对象
2792
2793
  getCurrentFrame,
2794
+ // 获取当前帧
2793
2795
  getVmml,
2796
+ // 获取vmml
2794
2797
  getPlayer,
2798
+ // 获取player实例
2795
2799
  texteditClose,
2796
2800
  textFinish,
2797
- updateVmml
2801
+ // 完成按钮事件
2802
+ editorSeekTo,
2803
+ // editor的seek事件 入参:frame
2804
+ updateEditor
2805
+ // 更新editor 入参:vmml, frame
2798
2806
  }),
2799
2807
  [vmmlState, player]
2800
2808
  );