From aaa28f1bd8d7d603cf07c67542e2874daf877d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=9B?= Date: Fri, 24 Jul 2026 16:44:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20TEXT=20=E5=AE=BD=E5=BA=A6=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E5=8C=96=20=E2=80=94=20=E5=8E=BB=E6=8E=89=20depth=3D?= =?UTF-8?q?=3D=3D1=20=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - parentW 超过 contentW 的 80% 时视为顶层,用 contentW - 否则用 parentW(表格单元格等嵌套容器) - 不再依赖 _depth 字段判断层级 --- convert-w2p.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/convert-w2p.js b/convert-w2p.js index 09b1354..c3c443d 100644 --- a/convert-w2p.js +++ b/convert-w2p.js @@ -559,11 +559,9 @@ function convert(input) { } } - // 宽度:顶层元素用 contentW,嵌套元素用 parentW,加最小宽度保障 + // 宽度:parentW 超过 contentW 的 80% 时视为顶层,用 contentW;否则用 parentW var textW = n.parentW || r.w; - if (n._depth === 1) { - textW = contentW; // 顶层文字用 slide 内容宽度 - } + if (textW > contentW * 0.8) textW = contentW; if (textW > contentW) textW = contentW; if (textW < 108) textW = 108; // 最小 1.5in = 108px // 确保 x + w 不超出 slide 内容区右边界