Showing
1 changed file
with
2 additions
and
2 deletions
| @@ -71,7 +71,7 @@ export struct PlayerTitleView { | @@ -71,7 +71,7 @@ export struct PlayerTitleView { | ||
| 71 | * @returns {string} clipStr 截断后的文本 '啊啊' | 71 | * @returns {string} clipStr 截断后的文本 '啊啊' |
| 72 | */ | 72 | */ |
| 73 | clipText(str: string, fontSize: number, maxLines: number, textWidth: number): string { | 73 | clipText(str: string, fontSize: number, maxLines: number, textWidth: number): string { |
| 74 | - let strArr: string[] = str.split("") | 74 | + let strArr: string[] = str.replace('\n', '').split("") |
| 75 | let truncateContent: string = '啊啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算 | 75 | let truncateContent: string = '啊啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算 |
| 76 | let measureTruncateWidth: number = measure.measureText({ | 76 | let measureTruncateWidth: number = measure.measureText({ |
| 77 | textContent: truncateContent, | 77 | textContent: truncateContent, |
| @@ -219,7 +219,7 @@ export struct PlayerTitleView { | @@ -219,7 +219,7 @@ export struct PlayerTitleView { | ||
| 219 | // } else { | 219 | // } else { |
| 220 | if (this.summary && this.titleLines < 4) { | 220 | if (this.summary && this.titleLines < 4) { |
| 221 | Text() { | 221 | Text() { |
| 222 | - Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50))) | 222 | + Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 160 - vp2px(50))) |
| 223 | .fontSize(14) | 223 | .fontSize(14) |
| 224 | .fontColor(Color.White) | 224 | .fontColor(Color.White) |
| 225 | .lineHeight(21) | 225 | .lineHeight(21) |
-
Please register or login to post a comment