@versa_ai/vmml-editor 1.0.23 → 1.0.25

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.23 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.25 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 113.36 KB
128
- ESM dist\index.mjs.map 217.80 KB
129
- ESM ⚡️ Build success in 820ms
130
- CJS dist\index.js 115.00 KB
131
- CJS dist\index.js.map 218.10 KB
132
- CJS ⚡️ Build success in 821ms
133
- DTS ⚡️ Build success in 2291ms
127
+ ESM dist\index.mjs 113.59 KB
128
+ ESM dist\index.mjs.map 218.26 KB
129
+ ESM ⚡️ Build success in 3284ms
130
+ CJS dist\index.js 115.23 KB
131
+ CJS dist\index.js.map 218.55 KB
132
+ CJS ⚡️ Build success in 3284ms
133
+ DTS ⚡️ Build success in 5029ms
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
@@ -1226,6 +1226,7 @@ var EditorCanvas = react.forwardRef(
1226
1226
  });
1227
1227
  if (editRenderTime.current === time) {
1228
1228
  canvas.add(...objects).renderAll();
1229
+ checkObjectInPoint();
1229
1230
  }
1230
1231
  };
1231
1232
  const createImageFromClip = (clip, fc2) => {
@@ -1320,12 +1321,13 @@ var EditorCanvas = react.forwardRef(
1320
1321
  }
1321
1322
  const { width, height } = vmml.template.dimension;
1322
1323
  const fontSize = vmmlUtils.getFontSize(width, height);
1323
- const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType, strokeColor, strokeWidth } = clip.textClip;
1324
+ const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType, strokeColor, strokeWidth, letterSpacing } = clip.textClip;
1324
1325
  const scaleX = posParam.scaleX * fontSize / 22 / widthScaleRef.current;
1325
1326
  const scaleY = posParam.scaleY * fontSize / 22 / heightScaleRef.current;
1326
1327
  const strokeW = strokeWidth * 26 * 1.5 / fontSize;
1328
+ const letterSpace = letterSpacing * 22 / fontSize;
1327
1329
  const left = canvasSize.width * posParam.centerX;
1328
- const top = canvasSize.height * posParam.centerY;
1330
+ const top = canvasSize.height * posParam.centerY - 2;
1329
1331
  const bgColor = backgroundColor ? vmmlUtils.argbToRgba(backgroundColor) : "transparent";
1330
1332
  const stColor = strokeColor ? vmmlUtils.argbToRgba(strokeColor) : "transparent";
1331
1333
  const isAiError = textContent === "\u8BF7\u8F93\u5165\u6587\u6848" && textColor === "#00000000";
@@ -1336,7 +1338,7 @@ var EditorCanvas = react.forwardRef(
1336
1338
  colorName: "custom",
1337
1339
  textAlign: alignType === 1 ? "center" : alignType === 2 ? "right" : "left"
1338
1340
  };
1339
- const textImgData = await createTextImg({ textContent, bgColor, stColor, strokeW, textColor: textFill, fontAssetUrl, textBasicInfo });
1341
+ const textImgData = await createTextImg({ textContent, bgColor, stColor, strokeW, textColor: textFill, fontAssetUrl, textBasicInfo, letterSpacing: letterSpace });
1340
1342
  const fontJSON = localStorage.getItem("VMML_PLAYER_FONTSMAP");
1341
1343
  let fontMap = {};
1342
1344
  try {
@@ -1440,7 +1442,7 @@ var EditorCanvas = react.forwardRef(
1440
1442
  return null;
1441
1443
  }
1442
1444
  };
1443
- const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo }) => {
1445
+ const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo, letterSpacing }) => {
1444
1446
  const fontBase64 = await loadFont(fontAssetUrl);
1445
1447
  const container = document.createElement("div");
1446
1448
  container.style.backgroundColor = bgColor;
@@ -1458,6 +1460,7 @@ var EditorCanvas = react.forwardRef(
1458
1460
  p.style.whiteSpace = "nowrap";
1459
1461
  p.style.margin = "0";
1460
1462
  p.style.padding = "0";
1463
+ if (letterSpacing) p.style.letterSpacing = `${letterSpacing}px`;
1461
1464
  p.style.zIndex = "2";
1462
1465
  const fill = document.createElement("span");
1463
1466
  fill.textContent = line || " ";
@@ -2702,7 +2705,7 @@ var EditorFn = ({
2702
2705
  if (editableArray.length && (vmmlState == null ? void 0 : vmmlState.template)) {
2703
2706
  initCanEditClips(vmmlState.template.tracks);
2704
2707
  }
2705
- }, [editableArray, refreshEdit]);
2708
+ }, [editableArray, refreshEdit, vmmlState]);
2706
2709
  react.useEffect(() => {
2707
2710
  var _a2;
2708
2711
  if (propVmml) {