Commit 66e19305 authored by limingzhe's avatar limingzhe

fix: debug

parent 3ab94d38
...@@ -431,10 +431,10 @@ cc.Class({ ...@@ -431,10 +431,10 @@ cc.Class({
//调起检测 //调起检测
startTesting() { startTesting() {
// this.getPhotoData((data) => { this.getPhotoData((data) => {
// this.photoEnd(data); this.photoEnd(data);
// }); });
// return; return;
const cw = window.courseware; const cw = window.courseware;
...@@ -959,6 +959,8 @@ cc.Class({ ...@@ -959,6 +959,8 @@ cc.Class({
const key = picNode.data.pointItem // i.toString(); const key = picNode.data.pointItem // i.toString();
console.log('key: ', key)
if (answerData[key] && answerData[key].isFinish) { if (answerData[key] && answerData[key].isFinish) {
this.showLetter(picNode); this.showLetter(picNode);
...@@ -975,14 +977,22 @@ cc.Class({ ...@@ -975,14 +977,22 @@ cc.Class({
// let writeRect = this.writeNodeArr[Number(index)]; // let writeRect = this.writeNodeArr[Number(index)];
console.log('in showLetter 1');
picNode.hitCount++; picNode.hitCount++;
if (picNode.hitCount < 1) { if (picNode.hitCount < 1) {
return; return;
} }
console.log('in showLetter 2');
if (picNode.isShowEnd) { if (picNode.isShowEnd) {
return; return;
} }
console.log('in showLetter 3');
picNode.isShowEnd = true; picNode.isShowEnd = true;
picNode.answerPic.active = true; picNode.answerPic.active = true;
...@@ -1101,9 +1111,15 @@ cc.Class({ ...@@ -1101,9 +1111,15 @@ cc.Class({
// y -= ( y - (baseY + unitH) ) * 0.35; // y -= ( y - (baseY + unitH) ) * 0.35;
const tempR = scaleRate * (checkLetter.unitY * unitH); const tempR = scaleRate * (checkLetter.unitY * unitH);
const newR = r - tempR; const newR = r - tempR;
const newW = w - tempR;
const newH = h - tempR;
const rate = newR / r; const rate = newR / r;
const tempY = ( y - (baseY) ) * postionRate; const tempY = ( y - (baseY) ) * postionRate;
...@@ -1113,8 +1129,9 @@ cc.Class({ ...@@ -1113,8 +1129,9 @@ cc.Class({
const tempX = (centerX - x) * postionRate; const tempX = (centerX - x) * postionRate;
x = x + tempX * (1-rate); x = x + tempX * (1-rate);
// const dot = this.getColorDot(x, -y, newR);
const dot = this.getColorDot(x, -y, newR, newR); // const dot = this.getColorDot(x, -y, newR, newR);
const dot = this.getColorDot(x, -y, newW, newH);
this.debugDrawLayer.addChild(dot, 5); this.debugDrawLayer.addChild(dot, 5);
dot.key = centerItemArr[i].index + 1; dot.key = centerItemArr[i].index + 1;
...@@ -1160,7 +1177,7 @@ cc.Class({ ...@@ -1160,7 +1177,7 @@ cc.Class({
width: Math.abs( location.right - location.left ), width: Math.abs( location.right - location.left ),
height: Math.abs( location.bottom - location.top ), height: Math.abs( location.bottom - location.top ),
} }
const colorRect = this.getColorRect(rect); const colorRect = this.getColorRect(rect, "purple");
colorRect.labelText = content; colorRect.labelText = content;
this.debugDrawLayer.addChild(colorRect); this.debugDrawLayer.addChild(colorRect);
...@@ -1244,12 +1261,16 @@ cc.Class({ ...@@ -1244,12 +1261,16 @@ cc.Class({
if (labelText.toLowerCase().indexOf(targetLabelText.toLowerCase()) != -1 && rect.intersects(dotRect)) { if (labelText.toLowerCase().indexOf(targetLabelText.toLowerCase()) != -1 && rect.intersects(dotRect)) {
const len = targetLabelText.trim().length; const len = targetLabelText.trim().length;
console.log('len: ', len);
if (!answerData[key]) { if (!answerData[key]) {
answerData[key] = {colorRect, count: len}; answerData[key] = {colorRect, count: len};
} else { } else {
answerData[key].count += len; answerData[key].count += len;
console.log('len: ', len);
console.log(' answerData[key].count: ', answerData[key].count);
} }
if ( labelText.length <= 1) { if ( labelText.length <= 1) {
...@@ -1878,7 +1899,7 @@ cc.Class({ ...@@ -1878,7 +1899,7 @@ cc.Class({
// } // }
// ] // ]
// } // }
const tmpData = { "allText" : "Look and Trace\nblackboard\nwindoy", "block" : [ { "line" : [ { "word" : [ { "content" : "Look", "location" : { "bottom" : 266.66665649414062, "top" : 249.60000610351562, "right" : 396.79998779296875, "left" : 364.39999389648438 }, "cornerPoint" : [ { "x" : 117, "y" : 118 }, { "x" : 117.35722351074219, "y" : 143.99754333496094 }, { "x" : 124.35655975341797, "y" : 143.9013671875 }, { "x" : 123.99933624267578, "y" : 117.90382385253906 } ] }, { "content" : "and", "location" : { "bottom" : 266.66665649414062, "top" : 249.60000610351562, "right" : 426.79998779296875, "left" : 402.79998779296875 }, "cornerPoint" : [ { "x" : 117, "y" : 150 }, { "x" : 117.26104736328125, "y" : 168.99819946289062 }, { "x" : 124.26038360595703, "y" : 168.90202331542969 }, { "x" : 123.99933624267578, "y" : 149.90382385253906 } ] }, { "content" : "Trace", "location" : { "bottom" : 264.5333251953125, "top" : 249.60000610351562, "right" : 470, "left" : 432.79998779296875 }, "cornerPoint" : [ { "x" : 117, "y" : 175 }, { "x" : 117.41218566894531, "y" : 204.99716186523438 }, { "x" : 123.41162109375, "y" : 204.91471862792969 }, { "x" : 122.99943542480469, "y" : 174.91755676269531 } ] } ] } ] }, { "line" : [ { "word" : [ { "content" : "blackboard", "location" : { "bottom" : 354.13333129882812, "top" : 315.73333740234375, "right" : 519.20001220703125, "left" : 434 }, "cornerPoint" : [ { "x" : 148, "y" : 176 }, { "x" : 150.16162109375, "y" : 245.96661376953125 }, { "x" : 165.15446472167969, "y" : 245.50340270996094 }, { "x" : 162.99284362792969, "y" : 175.53678894042969 } ] } ] } ] }, { "line" : [ { "word" : [ { "content" : "windoy", "location" : { "bottom" : 448, "top" : 420.26666259765625, "right" : 503.60000610351562, "left" : 425.60000610351562 }, "cornerPoint" : [ { "x" : 199, "y" : 168 }, { "x" : 197.54185485839844, "y" : 231.98338317871094 }, { "x" : 208.53900146484375, "y" : 232.2340087890625 }, { "x" : 209.99714660644531, "y" : 168.25062561035156 } ] } ] } ] } ]} const tmpData = {"allText":"Look and Trace\nblackboard\nwindow","block":[{"line":[{"word":[{"content":"Look","cornerPoint":[{"x":87,"y":203},{"x":83,"y":166},{"x":93,"y":164},{"x":97,"y":201}],"location":{"bottom":97,"left":85,"right":124,"top":83},"recognizedLanguage":"und"},{"content":"and","cornerPoint":[{"x":85,"y":161},{"x":82,"y":138},{"x":90,"y":137},{"x":93,"y":160}],"location":{"bottom":93,"left":127,"right":151,"top":82},"recognizedLanguage":"und"},{"content":"Trace","cornerPoint":[{"x":81,"y":132},{"x":77,"y":96},{"x":86,"y":95},{"x":90,"y":131}],"location":{"bottom":90,"left":156,"right":193,"top":77},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"blackboard","cornerPoint":[{"x":119,"y":129},{"x":116,"y":58},{"x":131,"y":57},{"x":134,"y":128}],"location":{"bottom":134,"left":159,"right":231,"top":116},"recognizedLanguage":"und"}]}]},{"line":[{"word":[{"content":"window","cornerPoint":[{"x":171,"y":123},{"x":166,"y":72},{"x":177,"y":70},{"x":182,"y":121}],"location":{"bottom":182,"left":165,"right":218,"top":166},"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":"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"}]}]}]} // 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"}]}]}]}
......
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