調整
This commit is contained in:
@@ -368,12 +368,20 @@
|
||||
details.forEach(d => {
|
||||
if (d.isActive != "hidden") {
|
||||
let newFontSize = self.scaleFontSize(mid, d.fontSize, d.width);
|
||||
|
||||
|
||||
let html = "";
|
||||
let alive = "";
|
||||
let yang = "";
|
||||
let bi = "";
|
||||
if (d.elementID === 'title1') {
|
||||
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
|
||||
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
|
||||
let rowWidth = Math.floor(Number(d.width) / rows);
|
||||
newFontSize = Math.floor(rowWidth / 2);
|
||||
if (newFontSize > d.fontSize) {
|
||||
newFontSize = d.fontSize;
|
||||
rowWidth = newFontSize * 2;
|
||||
}
|
||||
let $namelist = $(`<div class='nameList'></div>`).css({
|
||||
"writing-mode": "vertical rl",
|
||||
display: "flex",
|
||||
@@ -396,14 +404,14 @@
|
||||
let info = self.getTextInfo(z, newFontSize);
|
||||
let spanWidth = mid.length > 1 ? newFontSize : d.width
|
||||
let height = d.textHeight;
|
||||
if (info.width >= d.textHeight) {
|
||||
if (info.height >= d.textHeight) {//width
|
||||
height = d.height;
|
||||
}
|
||||
let $span = $(`<span class="nameSpan">${z}</span>`).css({
|
||||
display: "block",
|
||||
"min-height": `${height}px`,
|
||||
"max-height": `${d.height}px`,
|
||||
"max-width": `${spanWidth}px`,
|
||||
"max-width": `${rowWidth}px`,
|
||||
//width: `${newFontSize}px`,
|
||||
"text-align": "justify",
|
||||
"text-align-last": "justify",
|
||||
@@ -418,9 +426,18 @@
|
||||
|
||||
html = $namelist;
|
||||
} else if (d.elementID === "alive") {
|
||||
html = self.renderLiveList(left, d);
|
||||
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
|
||||
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
|
||||
let rowWidth = Math.floor(Number(d.width) / rows);
|
||||
newFontSize = Math.floor(rowWidth / 2);
|
||||
if (newFontSize > d.fontSize) {
|
||||
newFontSize = d.fontSize;
|
||||
rowWidth = newFontSize * 2;
|
||||
}
|
||||
console.log(d.height,d.width,d.textHeight,perRow,rows,rowWidth,newFontSize,d)
|
||||
html = self.renderLiveList(left, d, rowWidth);
|
||||
|
||||
newFontSize = d.fontSize;
|
||||
//newFontSize = d.fontSize;
|
||||
} else if (d.elementID === "titletriangle") {
|
||||
html = self.renderRoster(mid, d)
|
||||
} else if (d.elementID === "combined") {
|
||||
@@ -798,7 +815,7 @@
|
||||
fix2(val) {
|
||||
return Number.parseFloat(val).toFixed(2);
|
||||
},
|
||||
renderLiveList(names, el) {
|
||||
renderLiveList(names, el,rowWidth) {
|
||||
let $namelist = $(`<div class='liveList'></div>`).css({
|
||||
"writing-mode": "vertical rl",
|
||||
display: "flex",
|
||||
@@ -817,17 +834,17 @@
|
||||
});
|
||||
let self = this;
|
||||
names.forEach(n => {
|
||||
$namelist.append(self.renderLiveSpan(n, el))
|
||||
$namelist.append(self.renderLiveSpan(n, el,rowWidth))
|
||||
})
|
||||
return $namelist;
|
||||
},
|
||||
renderLiveSpan(name, el) {
|
||||
renderLiveSpan(name, el,rowWidth) {
|
||||
return $(`<span class="liveSpan">${name}</span>`).css({
|
||||
display: "block",
|
||||
"min-height": `${el.textHeight}px`,
|
||||
"max-height": `${el.height}px`,
|
||||
width: `${el.textWidth}px`,
|
||||
height: `${el.textHeight}px`,
|
||||
width: `${rowWidth}px`,
|
||||
|
||||
"text-align": "justify",
|
||||
"text-align-last": "justify",
|
||||
"margin-bottom": "10px",
|
||||
|
||||
Reference in New Issue
Block a user