@versa_ai/vmml-editor 1.0.29 → 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.29 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 114.18 KB
128
- ESM dist\index.mjs.map 219.48 KB
129
- ESM ⚡️ Build success in 693ms
130
- CJS dist\index.js 115.82 KB
131
- CJS dist\index.js.map 219.77 KB
132
- CJS ⚡️ Build success in 694ms
133
- DTS ⚡️ Build success in 1988ms
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,31 +2753,30 @@ var EditorFn = ({
2762
2753
  setPreviewState(false);
2763
2754
  }
2764
2755
  }, [dragState]);
2765
- const updateVmml = (v, checkFrame) => {
2766
- var _a2, _b;
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
- requestAnimationFrame(() => {
2774
- var _a3;
2775
- const convertedVmml = vmmlUtils.convertVmmlTextScaleByForbidden(v);
2764
+ const convertedVmml = vmmlUtils.convertVmmlTextScaleByForbidden(v);
2765
+ if (!isSame) {
2766
+ (_b = (_a2 = canvasCurrent == null ? void 0 : canvasCurrent.getCanvasCtx()) == null ? void 0 : _a2.clear) == null ? void 0 : _b.call(_a2);
2776
2767
  setVmmlState(convertedVmml);
2777
- setDurationInFrames(vmmlUtils.getFrames(((_a3 = v == null ? void 0 : v.template) == null ? void 0 : _a3.duration) || 1, fps));
2778
- playerCurrent.setVmml(convertedVmml, currentFrame);
2768
+ setDurationInFrames(vmmlUtils.getFrames(((_c = v == null ? void 0 : v.template) == null ? void 0 : _c.duration) || 1, fps));
2779
2769
  setRefreshEdit(Date.now());
2780
- if (canvasCurrent) {
2781
- canvasCurrent.checkObjectInPoint(currentFrame);
2782
- }
2783
- });
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);
2784
2774
  };
2785
2775
  const getCurrentFrame = () => {
2786
2776
  if (!player) return 0;
2787
2777
  return player.getCurrentFrame();
2788
2778
  };
2789
- const EditorSeekTo = (frame2) => {
2779
+ const editorSeekTo = (frame2) => {
2790
2780
  var _a2;
2791
2781
  (_a2 = player == null ? void 0 : player.seekTo) == null ? void 0 : _a2.call(player, frame2 ?? 0);
2792
2782
  const { current: canvasCurrent } = canvasRef;
@@ -2799,13 +2789,20 @@ var EditorFn = ({
2799
2789
  () => ({
2800
2790
  getActions,
2801
2791
  getfcObject,
2792
+ // 获取画布上所有对象
2802
2793
  getCurrentFrame,
2794
+ // 获取当前帧
2803
2795
  getVmml,
2804
- EditorSeekTo,
2796
+ // 获取vmml
2805
2797
  getPlayer,
2798
+ // 获取player实例
2806
2799
  texteditClose,
2807
2800
  textFinish,
2808
- updateVmml
2801
+ // 完成按钮事件
2802
+ editorSeekTo,
2803
+ // editor的seek事件 入参:frame
2804
+ updateEditor
2805
+ // 更新editor 入参:vmml, frame
2809
2806
  }),
2810
2807
  [vmmlState, player]
2811
2808
  );