fix: 合并文本框宽度用 rect.w 而非 parentW

合并节点的 parentW 继承自第一个子节点(如 strong 的窄宽度),
导致文本框太窄。改为用合并后的 rect.w。
This commit is contained in:
李进
2026-07-24 17:25:12 +08:00
parent f4adac77c5
commit 8f507256ef
+2 -2
View File
@@ -591,7 +591,7 @@ function convert(input) {
opts.fontSize = pt;
opts.fontFace = (st.fontFamily || 'Arial').split(',')[0].replace(/['"]/g,'').trim();
opts.color = rgbaToHex(st.color) || '000000';
if (parseInt(st.fontWeight) >= 700) opts.bold = true;
if (parseInt(st.fontWeight) >= 700 && !n._merged) opts.bold = true;
if (st.fontStyle === 'italic') opts.italic = true;
if (st.textAlign && st.textAlign !== 'start') opts.align = st.textAlign;
// 文字装饰
@@ -618,7 +618,7 @@ function convert(input) {
}
// 宽度:parentW 超过 contentW 的 80% 时视为顶层,用 contentW;否则用 parentW
var textW = n.parentW || r.w;
var textW = n._merged ? r.w : (n.parentW || r.w); // 合并节点用 rect.w
if (textW > contentW * 0.8) textW = contentW;
if (textW > contentW) textW = contentW;
if (textW < 108) textW = 108; // 最小 1.5in = 108px