@versa_ai/vmml-editor 1.0.47 → 1.0.48
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/.turbo/turbo-build.log +9 -9
- package/README.md +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +11 -6
package/package.json
CHANGED
|
@@ -327,7 +327,8 @@ const EditorCanvas = forwardRef(
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
const createTextObjs = async ({ strokeW, stColor, fontAssetUrl = null, letterSpace, bgColor, textContent, textBasicInfo, textColor }: any) => {
|
|
330
|
-
|
|
330
|
+
const { width, height } = vmml.template.dimension;
|
|
331
|
+
const fontSize = getFontSize(width, height);
|
|
331
332
|
// 加载字体
|
|
332
333
|
let fontFamily = 'sansMedium';
|
|
333
334
|
if (fontAssetUrl) {
|
|
@@ -340,7 +341,12 @@ const EditorCanvas = forwardRef(
|
|
|
340
341
|
const lines = textContent.split('\n').filter((item: string) => item);
|
|
341
342
|
|
|
342
343
|
const lineHeight = 22 + strokeW; // 行高
|
|
343
|
-
const paddingX = 7; // 左右内边距
|
|
344
|
+
// const paddingX = 7; // 左右内边距
|
|
345
|
+
// const paddingY = 7; // 上下内边距
|
|
346
|
+
// const round = 4; // 圆角
|
|
347
|
+
const paddingX = 60 * 22 / fontSize // 基于player做的修改
|
|
348
|
+
const paddingY = 50 * 22 / fontSize // 基于player做的修改
|
|
349
|
+
const round = 40 * 22 / fontSize // 基于player做的修改
|
|
344
350
|
const groupWidth = Math.max(...lines.map((l: any) => {
|
|
345
351
|
let options: any = { fontSize: 22, fontFamily, strokeWidth: strokeW ?? 0 }
|
|
346
352
|
if (letterSpace) options.charSpacing = letterSpace
|
|
@@ -402,12 +408,12 @@ const EditorCanvas = forwardRef(
|
|
|
402
408
|
// 背景矩形
|
|
403
409
|
const bgRect = new fabric.Rect({
|
|
404
410
|
width: groupWidth,
|
|
405
|
-
height: groupHeight +
|
|
411
|
+
height: groupHeight + paddingY * 2, // padddingY: 6.5
|
|
406
412
|
fill: bgColor,
|
|
407
413
|
originX: 'left',
|
|
408
414
|
originY: 'center',
|
|
409
|
-
rx:
|
|
410
|
-
ry:
|
|
415
|
+
rx: round,
|
|
416
|
+
ry: round,
|
|
411
417
|
});
|
|
412
418
|
return {
|
|
413
419
|
objects: [bgRect, ...textObjs],
|
|
@@ -425,7 +431,6 @@ const EditorCanvas = forwardRef(
|
|
|
425
431
|
const fontSize = getFontSize(width, height);
|
|
426
432
|
|
|
427
433
|
const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType, strokeColor, strokeWidth, letterSpacing } = clip.textClip;
|
|
428
|
-
// textContent = 'ฉันคือไมโครเวฟที่ครบทุกฟังก์\nชัน\nใครเห็นก็ต้องว้าว\n这是修改的啊啊啊啊'
|
|
429
434
|
const scaleX = posParam.scaleX * fontSize / 22 / widthScaleRef.current;
|
|
430
435
|
const scaleY = posParam.scaleY * fontSize / 22 / heightScaleRef.current;
|
|
431
436
|
const left = canvasSize.width * posParam.centerX;
|