refactor: TEXT 宽度通用化 — 去掉 depth===1 硬编码

- parentW 超过 contentW 的 80% 时视为顶层,用 contentW
- 否则用 parentW(表格单元格等嵌套容器)
- 不再依赖 _depth 字段判断层级
This commit is contained in:
李进
2026-07-24 16:44:54 +08:00
parent dd916dcf9e
commit aaa28f1bd8
+2 -4
View File
@@ -559,11 +559,9 @@ function convert(input) {
} }
} }
// 宽度:顶层元素用 contentW,嵌套元素用 parentW,加最小宽度保障 // 宽度:parentW 超过 contentW 的 80% 时视为顶层,用 contentW;否则用 parentW
var textW = n.parentW || r.w; var textW = n.parentW || r.w;
if (n._depth === 1) { if (textW > contentW * 0.8) textW = contentW;
textW = contentW; // 顶层文字用 slide 内容宽度
}
if (textW > contentW) textW = contentW; if (textW > contentW) textW = contentW;
if (textW < 108) textW = 108; // 最小 1.5in = 108px if (textW < 108) textW = 108; // 最小 1.5in = 108px
// 确保 x + w 不超出 slide 内容区右边界 // 确保 x + w 不超出 slide 内容区右边界