@versa_ai/vmml-editor 1.0.17 → 1.0.18

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.17 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.18 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -124,12 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
124
124
 
125
125
 
126
126
 
127
- ESM dist\index.mjs 110.95 KB
128
- ESM dist\index.mjs.map 213.03 KB
129
- ESM ⚡️ Build success in 1002ms
130
- CJS dist\index.js 112.57 KB
131
- CJS dist\index.js.map 213.32 KB
132
- CJS ⚡️ Build success in 1002ms
133
- DTS ⚡️ Build success in 2326ms
127
+ CJS dist\index.js 113.85 KB
128
+ CJS dist\index.js.map 215.74 KB
129
+ CJS ⚡️ Build success in 812ms
130
+ ESM dist\index.mjs 112.22 KB
131
+ ESM dist\index.mjs.map 215.45 KB
132
+ ESM ⚡️ Build success in 813ms
133
+ DTS ⚡️ Build success in 2001ms
134
134
  DTS dist\index.d.ts 158.00 B
135
135
  DTS dist\index.d.mts 158.00 B
package/dist/index.js CHANGED
@@ -577,8 +577,9 @@ var VmmlConverter = class {
577
577
  }
578
578
  //更新位置
579
579
  setPosParam(fObj) {
580
+ var _a, _b, _c, _d, _e, _f, _g, _h;
580
581
  const {
581
- clipData: { type },
582
+ clipData: { type, originClip },
582
583
  centerPoint,
583
584
  scaleX,
584
585
  scaleY,
@@ -586,24 +587,35 @@ var VmmlConverter = class {
586
587
  width,
587
588
  height
588
589
  } = fObj;
589
- let _scaleX, _scaleY, _centerX, _centerY;
590
+ let _scaleX, _scaleY, _centerX, _centerY, _scaleZ, _centerZ, _rotationX, _rotationY;
591
+ let key = "";
590
592
  if (type === "\u6587\u5B57") {
591
593
  _scaleX = 22 * scaleX * this.widthScale / this.fontSize;
592
594
  _scaleY = 22 * scaleY * this.heightScale / this.fontSize;
593
595
  _centerX = centerPoint.x / this.canvasSize.width;
594
596
  _centerY = centerPoint.y / this.canvasSize.height;
597
+ key = "textClip";
595
598
  } else if (type === "\u8868\u60C5\u5305") {
596
599
  _scaleX = width * scaleX * this.widthScale / width;
597
600
  _scaleY = height * scaleY * this.heightScale / height;
598
601
  _centerX = centerPoint.x / this.canvasSize.width;
599
602
  _centerY = centerPoint.y / this.canvasSize.height;
603
+ key = "videoClip";
600
604
  }
605
+ _scaleZ = ((_b = (_a = originClip == null ? void 0 : originClip[key]) == null ? void 0 : _a.posParam) == null ? void 0 : _b.scaleZ) ?? 1;
606
+ _centerZ = ((_d = (_c = originClip == null ? void 0 : originClip[key]) == null ? void 0 : _c.posParam) == null ? void 0 : _d.centerZ) ?? 0.5;
607
+ _rotationX = ((_f = (_e = originClip == null ? void 0 : originClip[key]) == null ? void 0 : _e.posParam) == null ? void 0 : _f.rotationX) ?? 0;
608
+ _rotationY = ((_h = (_g = originClip == null ? void 0 : originClip[key]) == null ? void 0 : _g.posParam) == null ? void 0 : _h.rotationY) ?? 0;
601
609
  return {
602
610
  scaleX: _scaleX,
603
611
  scaleY: _scaleY,
612
+ scaleZ: _scaleZ,
604
613
  centerX: _centerX,
605
614
  centerY: _centerY,
606
- rotationZ: angle
615
+ centerZ: _centerZ,
616
+ rotationZ: angle,
617
+ rotationX: _rotationX,
618
+ rotationY: _rotationY
607
619
  };
608
620
  }
609
621
  /**
@@ -1308,12 +1320,14 @@ var EditorCanvas = react.forwardRef(
1308
1320
  }
1309
1321
  const { width, height } = vmml.template.dimension;
1310
1322
  const fontSize = vmmlUtils.getFontSize(width, height);
1311
- const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType } = clip.textClip;
1323
+ const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType, strokeColor, strokeWidth } = clip.textClip;
1312
1324
  const scaleX = posParam.scaleX * fontSize / 22 / widthScaleRef.current;
1313
1325
  const scaleY = posParam.scaleY * fontSize / 22 / heightScaleRef.current;
1326
+ const strokeW = strokeWidth ? strokeWidth * 22 / fontSize : 0;
1314
1327
  const left = canvasSize.width * posParam.centerX;
1315
1328
  const top = canvasSize.height * posParam.centerY;
1316
1329
  const bgColor = backgroundColor ? vmmlUtils.argbToRgba(backgroundColor) : "transparent";
1330
+ const stColor = strokeColor ? vmmlUtils.argbToRgba(strokeColor) : "transparent";
1317
1331
  const isAiError = textContent === "\u8BF7\u8F93\u5165\u6587\u6848" && textColor === "#00000000";
1318
1332
  const textFill = vmmlUtils.argbToRgba(isAiError ? "#ffffffff" : textColor || "#ffffffff");
1319
1333
  const textBasicInfo = {
@@ -1322,7 +1336,7 @@ var EditorCanvas = react.forwardRef(
1322
1336
  colorName: "custom",
1323
1337
  textAlign: alignType === 1 ? "center" : alignType === 2 ? "right" : "left"
1324
1338
  };
1325
- const textImgData = await createTextImg({ textContent, bgColor, textColor: textFill, fontAssetUrl, textBasicInfo });
1339
+ const textImgData = await createTextImg({ textContent, bgColor, stColor, strokeW, textColor: textFill, fontAssetUrl, textBasicInfo });
1326
1340
  const fontJSON = localStorage.getItem("VMML_PLAYER_FONTSMAP");
1327
1341
  let fontMap = {};
1328
1342
  try {
@@ -1410,7 +1424,7 @@ var EditorCanvas = react.forwardRef(
1410
1424
  }
1411
1425
  return svgString;
1412
1426
  };
1413
- const createTextImg = async ({ textContent, bgColor, textColor, fontAssetUrl = null, textBasicInfo }) => {
1427
+ const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo }) => {
1414
1428
  const container = document.createElement("div");
1415
1429
  container.style.backgroundColor = bgColor;
1416
1430
  container.style.boxSizing = "content-box";
@@ -1426,6 +1440,9 @@ var EditorCanvas = react.forwardRef(
1426
1440
  p.style.fontFamily = fontFamily;
1427
1441
  p.style.whiteSpace = "nowrap";
1428
1442
  p.style.padding = "0";
1443
+ p.style.margin = "0";
1444
+ p.style.webkitTextStrokeWidth = `${strokeW ?? 0}px`;
1445
+ p.style.webkitTextStrokeColor = stColor;
1429
1446
  p.textContent = line || " ";
1430
1447
  container.appendChild(p);
1431
1448
  });
@@ -2414,10 +2431,12 @@ var EditorFn = ({
2414
2431
  const onPlayerReady = () => {
2415
2432
  const { current } = vmmlPlayerRef;
2416
2433
  vmmlFlag.current = false;
2434
+ let show = false;
2417
2435
  if (current && current.playerRef) {
2418
2436
  setPlayer(current.playerRef);
2419
2437
  current.unmute();
2420
2438
  if (!once.current) {
2439
+ show = true;
2421
2440
  once.current = true;
2422
2441
  } else {
2423
2442
  if (needPlay.current) {
@@ -2427,7 +2446,7 @@ var EditorFn = ({
2427
2446
  }
2428
2447
  }
2429
2448
  }
2430
- setShowCanvas(false);
2449
+ setShowCanvas(show);
2431
2450
  setLoading(false);
2432
2451
  };
2433
2452
  const onClickMain = () => {
@@ -2568,9 +2587,11 @@ var EditorFn = ({
2568
2587
  setFrame(e.detail.frame);
2569
2588
  };
2570
2589
  const onPlay = () => {
2590
+ setShowCanvas(false);
2571
2591
  setIsPlaying(true);
2572
2592
  };
2573
2593
  const onPause = () => {
2594
+ setShowCanvas(true);
2574
2595
  setIsPlaying(false);
2575
2596
  };
2576
2597
  const onWaiting = () => {