調整排版

This commit is contained in:
2026-09-07 16:14:35 +08:00
parent 22e7c008ef
commit 52a10420ae
2 changed files with 31 additions and 11 deletions
+15 -5
View File
@@ -1614,11 +1614,11 @@ html, body, * {
names = names[0].split("暨"); names = names[0].split("暨");
names[0] = names[0] + "暨"; names[0] = names[0] + "暨";
} }
const init_fontSize = Number(d.fontSize) > 40 ? 40 : Number(d.fontSize);
// 1. 初始判定與特例條件計算 // 1. 初始判定與特例條件計算
let items = names.map(name => { let items = names.map(name => {
let l = name.length; 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 }; return { name: name, l: l, isShort: isShort, isMulti: false, size: 0 };
}); });
@@ -1697,8 +1697,18 @@ html, body, * {
sizes = items.map(x => { sizes = items.map(x => {
let final_s = x.size; let final_s = x.size;
if (x.isShort) { 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; //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 }; 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 flexDir = isSpecial2 ? "column" : "row";
let flexJustify = isSpecial ? "center" : "flex-start"; let flexJustify = isSpecial ? "center" : "flex-start";
let flexAlign = "center"; let flexAlign = "center";
if (isSpecial4) v_gap = Number(h) / 4; //if (isSpecial4) v_gap = Number(h) / 4;
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical-rl", "writing-mode": "vertical-rl",
+16 -6
View File
@@ -899,10 +899,10 @@
renderNames = renderNames[0].split("暨"); renderNames = renderNames[0].split("暨");
renderNames[0] = renderNames[0] + "暨"; renderNames[0] = renderNames[0] + "暨";
} }
const init_fontSize = Number(d.fontSize) > 40 ? 40 : Number(d.fontSize);
let items = renderNames.map(name => { let items = renderNames.map(name => {
let l = name.length; 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 }; return { name: name, l: l, isShort: isShort, isMulti: false, size: 0 };
}); });
@@ -988,7 +988,17 @@
sizes = items.map(x => { sizes = items.map(x => {
let final_s = x.size; let final_s = x.size;
if (x.isShort) { 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) { if (final_s > max_s_for_th) {
final_s = max_s_for_th; final_s = max_s_for_th;
} }
@@ -1048,9 +1058,9 @@
let flexJustify = isSpecial ? "center" : "flex-start"; let flexJustify = isSpecial ? "center" : "flex-start";
let flexAlign = "center"; let flexAlign = "center";
if (isSpecial4) { //if (isSpecial4) {
v_gap = Number(h) / 4; // v_gap = Number(h) / 4;
} //}
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical-rl", "writing-mode": "vertical-rl",