@versa_ai/vmml-editor 1.0.32 → 1.0.33
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/dist/index.js +22 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +35 -10
package/dist/index.mjs
CHANGED
|
@@ -1439,6 +1439,25 @@ var EditorCanvas = forwardRef(
|
|
|
1439
1439
|
return null;
|
|
1440
1440
|
}
|
|
1441
1441
|
};
|
|
1442
|
+
const setTextAlign = (p, stroke, direction) => {
|
|
1443
|
+
if (direction === "center") {
|
|
1444
|
+
p.style.justifyContent = "center";
|
|
1445
|
+
stroke.style.left = "50%";
|
|
1446
|
+
stroke.style.top = "50%";
|
|
1447
|
+
stroke.style.transform = "translate(-50%, -50%)";
|
|
1448
|
+
}
|
|
1449
|
+
if (direction === "left") {
|
|
1450
|
+
stroke.style.left = "0";
|
|
1451
|
+
stroke.style.top = "0";
|
|
1452
|
+
stroke.style.transform = "none";
|
|
1453
|
+
}
|
|
1454
|
+
if (direction === "right") {
|
|
1455
|
+
p.style.justifyContent = "flex-end";
|
|
1456
|
+
stroke.style.right = "0";
|
|
1457
|
+
stroke.style.top = "50%";
|
|
1458
|
+
stroke.style.transform = "translateY(-50%)";
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1442
1461
|
const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo, letterSpacing }) => {
|
|
1443
1462
|
const fontBase64 = await loadFont(fontAssetUrl);
|
|
1444
1463
|
const container = document.createElement("div");
|
|
@@ -1460,7 +1479,6 @@ var EditorCanvas = forwardRef(
|
|
|
1460
1479
|
p.style.padding = "0";
|
|
1461
1480
|
if (letterSpacing) p.style.letterSpacing = `${letterSpacing}px`;
|
|
1462
1481
|
p.style.zIndex = "2";
|
|
1463
|
-
if (textWarapCenter) p.style.justifyContent = "center";
|
|
1464
1482
|
const fill = document.createElement("span");
|
|
1465
1483
|
fill.textContent = line || " ";
|
|
1466
1484
|
fill.style.color = textColor;
|
|
@@ -1472,15 +1490,9 @@ var EditorCanvas = forwardRef(
|
|
|
1472
1490
|
stroke.style.color = "transparent";
|
|
1473
1491
|
stroke.style.webkitTextStrokeWidth = `${strokeW}px`;
|
|
1474
1492
|
stroke.style.webkitTextStrokeColor = stColor;
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
stroke.style.transform = "translate(-50%, -50%)";
|
|
1479
|
-
} else {
|
|
1480
|
-
stroke.style.left = "0";
|
|
1481
|
-
stroke.style.top = "0";
|
|
1482
|
-
}
|
|
1483
|
-
stroke.style.zIndex = "-1";
|
|
1493
|
+
let dr = textBasicInfo.textAlign || "left";
|
|
1494
|
+
if (textWarapCenter) dr = "center";
|
|
1495
|
+
setTextAlign(p, stroke, dr);
|
|
1484
1496
|
p.appendChild(fill);
|
|
1485
1497
|
p.appendChild(stroke);
|
|
1486
1498
|
container.appendChild(p);
|