Commit 12f835eb authored by limingzhe's avatar limingzhe

fix: debug

parent 2bb256f7
No preview for this file type
......@@ -431,10 +431,10 @@ cc.Class({
//调起检测
startTesting() {
// this.getPhotoData((data) => {
// this.photoEnd(data);
// });
// return;
this.getPhotoData((data) => {
this.photoEnd(data);
});
return;
const cw = window.courseware;
......@@ -503,7 +503,6 @@ cc.Class({
const answerData = this.getAnswerData(data);
this.showUserRight(answerData);
......@@ -947,6 +946,7 @@ cc.Class({
showUserRight(answerData) {
console.log('answerData: ', answerData);
console.log('this.picNodeArr: ', this.picNodeArr);
if (Object.keys(answerData).length == 0) {
return;
......@@ -957,7 +957,8 @@ cc.Class({
const picNode = this.picNodeArr[i];
const key = i.toString();
const key = picNode.data.pointItem // i.toString();
if (answerData[key] && answerData[key].isFinish) {
this.showLetter(picNode);
......@@ -1116,7 +1117,7 @@ cc.Class({
const dot = this.getColorDot(x, -y, newR, newR);
this.debugDrawLayer.addChild(dot, 5);
dot.key = centerItemArr[i].index + 1;
dot.labelText = checkLetter.labelText;
dotArr.push(dot);
......@@ -1232,7 +1233,7 @@ cc.Class({
for (let i=0; i<dotArr.length; i++) {
const {dotRect, labelText} = dotArr[i];
const {dotRect, labelText, key} = dotArr[i];
// const {pos} = dotArr[i];
// if (rect.contains(pos)) {
......@@ -1242,18 +1243,21 @@ cc.Class({
if (labelText.toLowerCase().indexOf(targetLabelText.toLowerCase()) != -1 && rect.intersects(dotRect)) {
const len = targetLabelText.trim().length;
if (!answerData[i.toString()]) {
answerData[i.toString()] = {colorRect, count: len};
if (!answerData[key]) {
answerData[key] = {colorRect, count: len};
} else {
answerData[i.toString()].count += len;
answerData[key].count += len;
}
if ( labelText.length > 1) {
answerData[i.toString()].isFinish = true;
answerData[key].isFinish = true;
} else {
if (answerData[i.toString()].count >= labelText.length) {
answerData[i.toString()].isFinish = true;
if (answerData[key].count >= labelText.length) {
answerData[key].isFinish = true;
}
}
......@@ -1481,9 +1485,9 @@ cc.Class({
console.log(' in initDebugLayer');
const layer = new cc.Node();
if (this.data.isDebug) {
// if (this.data.isDebug) {
layer.parent = cc.find('Canvas');
}
// }
layer.width = this.canvas.width / 2;
......@@ -1704,7 +1708,178 @@ cc.Class({
getPhotoData(cb) {
const tmpData = {"allText":"Trace ttre letters\nLook! She is Short\nShe is a\ngirl.\nShe is a\ngirl.\nShe is smiling. She is","block":[{"line":[{"word":[{"content":"Trace","cornerPoint":[{"x":460,"y":366},{"x":416,"y":366},{"x":416,"y":354},{"x":460,"y":354}],"location":{"bottom":126,"left":20,"right":64,"top":114},"recognizedLanguage":"und"},{"content":"ttre","cornerPoint":[{"x":412,"y":367},{"x":387,"y":367},{"x":387,"y":354},{"x":412,"y":354}],"location":{"bottom":126,"left":68,"right":93,"top":113},"recognizedLanguage":"und"},{"content":"letters","cornerPoint":[{"x":384,"y":367},{"x":334,"y":367},{"x":334,"y":354},{"x":384,"y":354}],"location":{"bottom":126,"left":96,"right":146,"top":113},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"Look!","cornerPoint":[{"x":340,"y":316},{"x":300,"y":318},{"x":299,"y":305},{"x":339,"y":303}],"location":{"bottom":177,"left":140,"right":181,"top":162},"recognizedLanguage":"und"}]}]}]}
// const tmpData =
// {
// "allText": "Look and Trace blackboard windoW",
// "block": [
// {
// "line": [
// {
// "word": [
// {
// "cornerPoint": [
// {
// "x": 308,
// "y": 193
// },
// {
// "x": 308.3586730957031,
// "y": 167.00247192382812
// },
// {
// "x": 317.3578186035156,
// "y": 167.1266326904297
// },
// {
// "x": 316.9991455078125,
// "y": 193.12416076660156
// }
// ],
// "content": "Look",
// "location": {
// "bottom": 194,
// "top": 167,
// "right": 318,
// "left": 308
// },
// "recognizedLanguage": "en"
// },
// {
// "cornerPoint": [
// {
// "x": 309,
// "y": 161
// },
// {
// "x": 309.2621154785156,
// "y": 142.00181579589844
// },
// {
// "x": 318.2612609863281,
// "y": 142.1259765625
// },
// {
// "x": 317.9991455078125,
// "y": 161.12416076660156
// }
// ],
// "content": "and",
// "location": {
// "bottom": 162,
// "top": 142,
// "right": 319,
// "left": 309
// },
// "recognizedLanguage": "en"
// },
// {
// "cornerPoint": [
// {
// "x": 309,
// "y": 136
// },
// {
// "x": 309.4276428222656,
// "y": 105.0029525756836
// },
// {
// "x": 318.4267883300781,
// "y": 105.12711334228516
// },
// {
// "x": 317.9991455078125,
// "y": 136.12416076660156
// }
// ],
// "content": "Trace",
// "location": {
// "bottom": 137,
// "top": 105,
// "right": 319,
// "left": 309
// },
// "recognizedLanguage": "en"
// }
// ]
// }
// ]
// },
// {
// "line": [
// {
// "word": [
// {
// "cornerPoint": [
// {
// "x": 350,
// "y": 141
// },
// {
// "x": 351.0197448730469,
// "y": 52.00584030151367
// },
// {
// "x": 369.0185546875,
// "y": 52.21207809448242
// },
// {
// "x": 367.9988098144531,
// "y": 141.20623779296875
// }
// ],
// "content": "blackboard",
// "location": {
// "bottom": 142,
// "top": 52,
// "right": 370,
// "left": 350
// },
// "recognizedLanguage": "en"
// }
// ]
// }
// ]
// },
// {
// "line": [
// {
// "word": [
// {
// "cornerPoint": [
// {
// "x": 431,
// "y": 134
// },
// {
// "x": 431.9438171386719,
// "y": 42.00484085083008
// },
// {
// "x": 452.9427185058594,
// "y": 42.220279693603516
// },
// {
// "x": 451.9989013671875,
// "y": 134.21543884277344
// }
// ],
// "content": "windoW",
// "location": {
// "bottom": 135,
// "top": 42,
// "right": 453,
// "left": 431
// },
// "recognizedLanguage": "en"
// }
// ]
// }
// ]
// }
// ]
// }
const tmpData = {"allText":"Look and Trace\nblackboar\nwindow","block":[{"line":[{"word":[{"content":"Look","cornerPoint":[{"x":226,"y":317},{"x":224,"y":276},{"x":236,"y":275},{"x":238,"y":316}],"location":{"bottom":238,"left":163,"right":205,"top":224},"recognizedLanguage":"und"},{"content":"and","cornerPoint":[{"x":224,"y":269},{"x":223,"y":239},{"x":235,"y":238},{"x":236,"y":268}],"location":{"bottom":236,"left":211,"right":242,"top":223},"recognizedLanguage":"und"},{"content":"Trace","cornerPoint":[{"x":222,"y":232},{"x":220,"y":185},{"x":233,"y":184},{"x":235,"y":231}],"location":{"bottom":235,"left":248,"right":296,"top":220},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"blackboar","cornerPoint":[{"x":270,"y":233},{"x":272,"y":144},{"x":296,"y":144},{"x":294,"y":233}],"location":{"bottom":296,"left":247,"right":336,"top":270},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"window","cornerPoint":[{"x":342,"y":230},{"x":340,"y":146},{"x":359,"y":145},{"x":361,"y":229}],"location":{"bottom":361,"left":250,"right":335,"top":340},"recognizedLanguage":"und"}]}]}]}
// const tmpData = {"allText":"Trace ttre letters\nLook! She is Short\nShe is a\ngirl.\nShe is a\ngirl.\nShe is smiling. She is","block":[{"line":[{"word":[{"content":"Trace","cornerPoint":[{"x":460,"y":366},{"x":416,"y":366},{"x":416,"y":354},{"x":460,"y":354}],"location":{"bottom":126,"left":20,"right":64,"top":114},"recognizedLanguage":"und"},{"content":"ttre","cornerPoint":[{"x":412,"y":367},{"x":387,"y":367},{"x":387,"y":354},{"x":412,"y":354}],"location":{"bottom":126,"left":68,"right":93,"top":113},"recognizedLanguage":"und"},{"content":"letters","cornerPoint":[{"x":384,"y":367},{"x":334,"y":367},{"x":334,"y":354},{"x":384,"y":354}],"location":{"bottom":126,"left":96,"right":146,"top":113},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"Look!","cornerPoint":[{"x":340,"y":316},{"x":300,"y":318},{"x":299,"y":305},{"x":339,"y":303}],"location":{"bottom":177,"left":140,"right":181,"top":162},"recognizedLanguage":"und"}]}]}]}
// const tmpData = {"allText":"e-Tnace the lettEr5\nAa Aa\nAa\nB b Bb Bbb\nBb\nCc\nCc","block":[{"line":[{"word":[{"content":"e-Tnace","cornerPoint":[{"x":399,"y":393},{"x":317,"y":395},{"x":316,"y":379},{"x":398,"y":377}],"location":{"bottom":103,"left":81,"right":164,"top":85},"recognizedLanguage":"und"},{"content":"the","cornerPoint":[{"x":313,"y":396},{"x":282,"y":396},{"x":281,"y":380},{"x":312,"y":380}],"location":{"bottom":100,"left":167,"right":199,"top":84},"recognizedLanguage":"und"},{"content":"lettEr5","cornerPoint":[{"x":278,"y":397},{"x":217,"y":398},{"x":216,"y":382},{"x":277,"y":381}],"location":{"bottom":99,"left":202,"right":264,"top":82},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"Aa","cornerPoint":[{"x":436,"y":362},{"x":349,"y":363},{"x":348,"y":322},{"x":435,"y":321}],"location":{"bottom":159,"left":44,"right":132,"top":117},"recognizedLanguage":"und"}]}]}]}
cb(tmpData);
......
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