調整排版
This commit is contained in:
@@ -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 = $(`<div class='nameList'></div>`).css({
|
||||
"writing-mode": "vertical-rl",
|
||||
|
||||
@@ -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 = $(`<div class='nameList'></div>`).css({
|
||||
"writing-mode": "vertical-rl",
|
||||
|
||||
Reference in New Issue
Block a user