feat(文字预览): 优化文字预览内存占用
build.yaml / build (push) Successful in 46s

This commit is contained in:
xiaoqidun committed 2026-10-10 14:00:41 +08:00
1 parent 5545c3d4b5
commit e99501ca5f
2 files changed
+11 -4

No files matched your search

+2 -2
View File
@@ -1379,6 +1379,8 @@ export class CanvasEditor {
bottom = Math.max(bottom, y + size - baseline);
}
for (const char of run.text) {
x = run.positions[index][0] * PX_PER_MM;
y = run.positions[index][1] * PX_PER_MM;
const span = document.createElement("span"), node = document.createTextNode(char);
span.append(node);
Object.assign(span.style, { display: "inline-block", opacity: String((item.alpha ?? 255) / 255), transformOrigin: "left top", transform: `translate(${x - naturalX}px,${y - baseline - lineIndex * size}px) scaleX(${source.scale})` });
@@ -1391,8 +1393,6 @@ export class CanvasEditor {
right = Math.max(right, x + advance * source.scale);
bottom = Math.max(bottom, y + size - baseline);
naturalX += advance;
x += run.dx?.length ? run.dx[Math.min(index, run.dx.length - 1)] * PX_PER_MM : 0;
y += run.dy?.length ? run.dy[Math.min(index, run.dy.length - 1)] * PX_PER_MM : 0;
index++;
}
if (!line.hasChildNodes()) {