Commit b59c9ccd authored by 李维's avatar 李维

dev commit

parent 082f5165
......@@ -108,15 +108,15 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
for(let i=0; i<this.grid.length; i++) {
for(let j=0; j<this.grid[i].length; j++) {
if(this.checkIndex(this.grid[i][j].index, index)) {
this.grid[i][j].index = [];
this.grid[i][j].index.length = 0;
this.grid[i][j].text = "";
}
if(del) {
this.grid[i][j].index.forEach(temIndex => {
if(temIndex > index) {
temIndex--;
for(let key=0; key<this.grid[i][j].index.length; key++) {
if(this.grid[i][j].index[key] > index) {
this.grid[i][j].index[key]--;
}
});
}
}
}
}
......
......@@ -1257,34 +1257,40 @@ export class PlayComponent implements OnInit, OnDestroy {
}
showCheckPannel(checkResult) {
const creatItem = (height, withSplit, data) => {
let padding = 30;
const creatItem = (withSplit, data) => {
let heightData = {
text: 0,
textLineNum: 0,
word: 0,
right: 0,
line: 0,
textRef: null,
wordRef: null,
rightRef: null,
lineRef: null
}
let scrollContent = this.g_cartoon.getCartoonElement("check_scroll_pannel")
let totalHeight = height
let text = this.g_cartoon.createCartoonElementLabel("text", data.text, "Aileron-Bold", "#FFFFFF", 48)
text.ref.textAlign = "left";
text.ref.warpLineHeight = 64;
text.ref.maxSingalLineWidth = 800;
text.ref.refreshSize();
text.ref.x = 0
if(text.ref.lineNum == 0) {
text.ref.warpLineHeight = 0;
text.ref.maxSingalLineWidth = 0;
text.ref.refreshSize();
text.ref.y = totalHeight
text.ref.y += 62
} else {
text.ref.baseY = totalHeight
}
totalHeight += (text.ref.lineNum + 1) * 64;
heightData.textRef = text.ref;
heightData.textLineNum = text.ref.lineNum
heightData.text = (text.ref.lineNum + 1) * 64
scrollContent.ref.addChild(text.ref)
let wordColorBG = this.g_cartoon.createCartoonElementShapeRect("wordColorBG", 360, 64, data.right?"#007b3e":"#d71818");
wordColorBG.ref.radius = 16
wordColorBG.ref.y = totalHeight + padding + 64 / 2
totalHeight += padding + 64;
heightData.wordRef = wordColorBG.ref
heightData.word = 64;
let word = this.g_cartoon.createCartoonElementLabel("text-label", data.word, "Aileron-Bold", "#FFFFFF", 48)
word.ref.x = 360 / 2
......@@ -1301,16 +1307,17 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w, h)=>{
return {
x: scrollContent.ref.width / 2,
y: totalHeight + 50 + 60
y: 0
}
})
totalHeight += 120 + padding;
heightData.rightRef = ele.ref
let word = this.g_cartoon.createCartoonElementLabel("text-label", data.rightWord, "Aileron-Bold", "#ffe9b1", 52)
word.ref.x = 0
word.ref.x = -797 / 2 + 150
word.ref.y = 0
ele.ref.addChild(word.ref)
heightData.right = 120;
scrollContent.ref.addChild(ele.ref)
}
......@@ -1323,26 +1330,60 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w, h)=>{
return {
x: 880 / 2,
y: totalHeight + 50
y: 0
}
})
totalHeight += padding + 10;
heightData.line = 10;
heightData.lineRef = splitLine.ref
scrollContent.ref.addChild(splitLine.ref);
}
return totalHeight
return heightData
}
let scrollContent = this.g_cartoon.getCartoonElement("check_scroll_pannel")
let sliderBG = this.g_cartoon.getCartoonElement("slider-background")
let totalHeight = 0;
let heigthData = [];
let totalNum = checkResult.length;
checkResult.forEach((element, index) => {
totalHeight = creatItem(totalHeight, !(index==(totalNum-1)), element)
heigthData.push(creatItem(!(index==(totalNum-1)), element))
});
this.m_totalScrollHeight = totalHeight + 100;
let totalHeight = 0
let padding = 30;
heigthData.forEach(item=>{
totalHeight += item.text
totalHeight += item.word
totalHeight += item.right
totalHeight += item.line
})
let countY = 0;
heigthData.forEach(item=>{
if(item.textLineNum>0) {
item.textRef.baseY = countY - item.text + 64 * 1.5;
} else {
item.textRef.y = countY + 64 / 2;
}
countY += item.text + padding
if(item.wordRef) {
item.wordRef.y = countY;
countY += item.word + padding
}
if(item.rightRef) {
item.rightRef.y = countY + item.right /2;
countY += item.right + padding
}
if(item.lineRef) {
item.lineRef.y = countY;
countY += item.line + padding
}
})
this.m_totalScrollHeight = totalHeight + 200;
sliderBG.initSlider(scrollContent.windowHeight, this.m_totalScrollHeight, 0)
let scroll = this.g_cartoon.getCartoonElement("check_scroll_pannel")
scroll.ref.setSize(880, this.m_totalScrollHeight)
......@@ -1532,8 +1573,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let questionText = this.g_cartoon.getCartoonElement("question_text");
questionText.ref.text = this.g_formData.dataArray[toIndex].text
questionText.ref.refreshSize();
if(questionText.ref.width > 1920) {
questionText.ref.setScaleXY(1920/questionText.ref.width);
if(questionText.ref.width > 1800) {
questionText.ref.setScaleXY(1800/questionText.ref.width);
}
let nextButton = this.g_cartoon.getCartoonElement("question_next")
......
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