Commit d4a4cfc5 authored by 李维's avatar 李维

修改问题文字折行

parent 71c9adb0
...@@ -1653,12 +1653,39 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1653,12 +1653,39 @@ export class PlayComponent implements OnInit, OnDestroy {
let indexText = this.g_cartoon.getCartoonElement("question_index") let indexText = this.g_cartoon.getCartoonElement("question_index")
indexText.ref.text = this.m_questionIndexArray[toIndex]; indexText.ref.text = this.m_questionIndexArray[toIndex];
let questionText = this.g_cartoon.getCartoonElement("question_text"); let questionText = this.g_cartoon.getCartoonElement("question_text");
questionText.ref.text = this.g_formData.dataArray[toIndex].text questionText.ref.text = this.g_formData.dataArray[toIndex].text
questionText.ref.refreshSize(); questionText.ref.refreshSize();
let lettersArr = questionText.ref.text.split(" ")
let preArr = lettersArr.map(item=>{
if(item!="") {
return item
}
})
//去除undefined后的结果
lettersArr = [];
for(var i=0;i<preArr.length;i++){
if(typeof(preArr[i])!='undefined'){
lettersArr.push(preArr[i]);
}
}
if(lettersArr.length > 14) {
questionText.ref.maxSingalLineWidth = 1800
questionText.ref.baseY = -64
questionText.ref.x = -900
questionText.ref.textAlign = "left"
} else {
questionText.ref.x = 0
questionText.ref.textAlign = "center"
questionText.ref.baseY = 0
if(questionText.ref.width > 1800) { if(questionText.ref.width > 1800) {
questionText.ref.setScaleXY(1800/questionText.ref.width); questionText.ref.setScaleXY(1800/questionText.ref.width);
} }
}
let nextButton = this.g_cartoon.getCartoonElement("question_next") let nextButton = this.g_cartoon.getCartoonElement("question_next")
if(this.g_formData.dataArray.length>toIndex+1) { if(this.g_formData.dataArray.length>toIndex+1) {
......
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