Commit a8c3b205 authored by Seaborn Lee's avatar Seaborn Lee

feat: 标点符号始终保持黑色

parent 4273faa8
......@@ -712,12 +712,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// console.log('letter:',letter) ;
const array = this.split(letter.letter_val);
let letter_spr = new Label();
letter_spr.ctx.fillStyle = "#000";
letter_spr.text = letter.letter_val;
letter_spr.text = array[0];
letter_spr.textAlign = 'left';
// letter_spr.fontSize = word_content.word_font_size ? word_content.word_font_size : 110;
letter_spr.fontSize = 40;
letter_spr.fontName = 'GOTHICB';
letter_spr.fontColor = this.getColor(letter.letter_color);
......@@ -727,24 +727,31 @@ export class PlayComponent implements OnInit, OnDestroy {
rowHeight = letter_spr.height;
letter_spr.y = rows * rowHeight - rowHeight / 2;
tempWidth += letter_spr.width + 10;
tempWidth += letter_spr.width;
rowGroup[rows - 1].letterLabels.push(letter_spr);
rowGroup[rows - 1].width = tempWidth;
let symbol;
if (array[1]) {
symbol = new Label();
symbol.ctx.fillStyle = "#000";
symbol.text = array[1];
symbol.textAlign = 'left';
symbol.fontSize = 40;
symbol.fontName = 'GOTHICB';
symbol.fontColor = this.getColor('C04');
symbol.refreshSize();
//设置坐标
symbol.x = tempWidth + 5;
rowHeight = symbol.height;
/* if(letter.is_=="1"){
//遇到换行
rows++;
if(tempWidth>totalWidth){
totalWidth = tempWidth+10;
symbol.y = rows * rowHeight - rowHeight / 2;
tempWidth += symbol.width;
rowGroup[rows - 1].letterLabels.push(symbol);
rowGroup[rows - 1].width = tempWidth;
}
tempWidth = 0;
rowGroup.push({
width: 0,
letterLabels: []
});
} */
tempWidth += 10;
if (i == letters.length - 1) {
if (tempWidth > totalWidth) {
......@@ -752,6 +759,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
word_bg.addChild(letter_spr);
if (symbol) {
word_bg.addChild(symbol);
}
}
//重新调整位置,使文字居中
......@@ -1086,4 +1096,12 @@ export class PlayComponent implements OnInit, OnDestroy {
audio.pause();
audio.currentTime = 0;
}
private split(text: string) {
if (text.match(/^.*[,|.|!|?]$/)) {
return [text.substr(0, text.length - 1), text.substr(text.length - 1, 1)]
}
return [text];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment