From 52a10420aea313c2c5fc1722ad1f48c974eb63b0 Mon Sep 17 00:00:00 2001 From: minom Date: Mon, 7 Sep 2026 16:14:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/admin/print/TabletDesign.aspx | 20 ++++++++++++----- web/admin/print/tablet_edit/editorNewOne.html | 22 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/web/admin/print/TabletDesign.aspx b/web/admin/print/TabletDesign.aspx index 436e839..7209180 100644 --- a/web/admin/print/TabletDesign.aspx +++ b/web/admin/print/TabletDesign.aspx @@ -1614,11 +1614,11 @@ html, body, * { names = names[0].split("暨"); names[0] = names[0] + "暨"; } - + const init_fontSize = Number(d.fontSize) > 40 ? 40 : Number(d.fontSize); // 1. 初始判定與特例條件計算 let items = names.map(name => { let l = name.length; - let isShort = (l * 40) <= (th + (v_gap / 2)); + let isShort = (l * init_fontSize) <= (th + (v_gap / 2)); return { name: name, l: l, isShort: isShort, isMulti: false, size: 0 }; }); @@ -1697,8 +1697,18 @@ html, body, * { sizes = items.map(x => { let final_s = x.size; if (x.isShort) { - let max_s_for_th = Math.floor(th / (maxShortLen * 1.333)); - if (final_s > max_s_for_th) final_s = max_s_for_th; + //let max_s_for_th = Math.floor(th / (maxShortLen * 1.333)); + //if (final_s > max_s_for_th) final_s = max_s_for_th; + let available_h = th; + if (isSpecial) { + if (isSpecial1 || isSpecial2) available_h = h / 2; + if (isSpecial4) available_h = (h / 2) - v_gap - 2; + } + let max_s_for_th = Math.floor(available_h / (maxShortLen * 1.333)); + + if (final_s > max_s_for_th) { + final_s = max_s_for_th; + } } return { name: x.name, size: final_s, isMulti: x.isMulti, isShort: x.isShort }; }); @@ -1733,7 +1743,7 @@ html, body, * { let flexDir = isSpecial2 ? "column" : "row"; let flexJustify = isSpecial ? "center" : "flex-start"; let flexAlign = "center"; - if (isSpecial4) v_gap = Number(h) / 4; + //if (isSpecial4) v_gap = Number(h) / 4; let $namelist = $(`
`).css({ "writing-mode": "vertical-rl", diff --git a/web/admin/print/tablet_edit/editorNewOne.html b/web/admin/print/tablet_edit/editorNewOne.html index 8c1c499..4c766c8 100644 --- a/web/admin/print/tablet_edit/editorNewOne.html +++ b/web/admin/print/tablet_edit/editorNewOne.html @@ -899,10 +899,10 @@ renderNames = renderNames[0].split("暨"); renderNames[0] = renderNames[0] + "暨"; } - + const init_fontSize = Number(d.fontSize) > 40 ? 40 : Number(d.fontSize); let items = renderNames.map(name => { let l = name.length; - let isShort = (l * 40) <= (th + (v_gap / 2)); + let isShort = (l * init_fontSize) <= (th + (v_gap / 2)); return { name: name, l: l, isShort: isShort, isMulti: false, size: 0 }; }); @@ -988,7 +988,17 @@ sizes = items.map(x => { let final_s = x.size; if (x.isShort) { - let max_s_for_th = Math.floor(th / (maxShortLen * 1.333)); + //let max_s_for_th = Math.floor(th / (maxShortLen * 1.333)); + //if (final_s > max_s_for_th) { + // final_s = max_s_for_th; + //} + let available_h = th; + if (isSpecial) { + if (isSpecial1 || isSpecial2) available_h = h / 2; + if (isSpecial4) available_h = (h / 2) - v_gap - 2; + } + let max_s_for_th = Math.floor(available_h / (maxShortLen * 1.333)); + if (final_s > max_s_for_th) { final_s = max_s_for_th; } @@ -1048,9 +1058,9 @@ let flexJustify = isSpecial ? "center" : "flex-start"; let flexAlign = "center"; - if (isSpecial4) { - v_gap = Number(h) / 4; - } + //if (isSpecial4) { + // v_gap = Number(h) / 4; + //} let $namelist = $(`
`).css({ "writing-mode": "vertical-rl",