Commit 33376618 authored by limingzhe's avatar limingzhe

fix: debug

parent 7ff91aec
{"ver":"1.1.2","uuid":"e9f579c0-59b7-4567-93ad-5b17f799e827","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "e9f579c0-59b7-4567-93ad-5b17f799e827",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
......@@ -1977,6 +1977,22 @@ cc.Class({
console.log(' this.photo end ', data);
if (this.debugLayer.parent && this.debugLayer.active) {
if (this.isCanDraw) {
return;
}
this.isCanDraw = true;
delayCall(0.1, () => {
this.isCanDraw = false;
})
}
if (!this.canTouch && isPool == false) {
this.dataPool.push(data);
console.log('! cantouch')
......@@ -1996,17 +2012,6 @@ cc.Class({
if (this.debugLayer.parent && this.debugLayer.active) {
if (this.isCanDraw) {
return;
}
this.isCanDraw = true;
delayCall(0.1, () => {
this.isCanDraw = false;
})
}
......@@ -2705,7 +2710,11 @@ cc.Class({
location.top = lineBox.top;
location.bottom = lineBox.bottom;
wordArr.push({content, location});
const centerX = location.left + (location.right - location.left) / 2;
const centerY = location.top + (location.bottom - location.top) / 2;
const centerLoc = [centerX, centerY];
wordArr.push({content, location, centerLoc});
textIndex += content.length;
}
......@@ -2718,7 +2727,7 @@ cc.Class({
const arr = line.characters;
for (let i=0; i<arr.length; i++) {
const {character, poly} = arr[i];
const {character, poly, centerLoc} = arr[i];
const content = character;
const location = {}
......@@ -2727,7 +2736,7 @@ cc.Class({
location.right = poly[2];
location.bottom = poly[7];
wordArr.push({content, location});
wordArr.push({content, location, centerLoc});
}
return wordArr;
......@@ -3219,7 +3228,7 @@ cc.Class({
const h = checkLetter.unitH * unitH;
const r = Math.min(w, h)
const dot = this.getColorDot(x, -y, w / 2, h / 2);
const dot = this.getColorDot(x, -y, w , h );
if (this.debugLayer.parent && this.debugLayer.active) {
......@@ -3262,7 +3271,7 @@ cc.Class({
for (let k=0; k<tempWordArr.length; k++) {
const {location , content} = tempWordArr[k];
const {location , content, centerLoc} = tempWordArr[k];
const rect = {
x: location.left,
......@@ -3272,14 +3281,18 @@ cc.Class({
}
const colorRect = this.getColorRect(rect, "purple");
// const colorRect = this.getColorRect(rect, "purple");
const colorRect = this.getColorDot(centerLoc[0], -centerLoc[1], 0.02, 0.02, 'purple');
colorRect.labelText = content;
// this.debugDrawLayer.addChild(colorRect);
if (this.debugLayer.parent && this.debugLayer.active) {
const label = this.getLabel(content, colorRect.scaleX * colorRect.width);
// const label = this.getLabel(content, colorRect.scaleX * colorRect.width);
const label = this.getLabel(content, rect.width * this.debugBgImg.width);
label.x = colorRect.x + colorRect.width / 2 * colorRect.scaleX;
label.y = colorRect.y + colorRect.height / 2 * colorRect.scaleY;
label.color = cc.Color.BLACK;
......@@ -3582,7 +3595,8 @@ cc.Class({
// console.log('labelText.toLowerCase() : ', labelText.toLowerCase() );
// console.log('rect.intersects(dotRect) : ', rect.intersects(dotRect) );
if (labelText.indexOf(targetLabelText) != -1 && rect.intersects(dotRect)) {
if (labelText.indexOf(targetLabelText) != -1 && dotRect.intersects(rect)) {
// if (labelText.indexOf(targetLabelText) != -1 && rect.intersects(dotRect)) {
// if (labelText.toLowerCase().indexOf(targetLabelText.toLowerCase()) != -1 && rect.intersects(dotRect)) {
const len = targetLabelText.trim().length;
......@@ -3751,7 +3765,7 @@ cc.Class({
getColorDot(x, y, w=100, h=100, color='red') {
const node = this.getNewNode(color)// new cc.Node();
let node = new cc.Node();
if (!h) {
h = w;
......@@ -3764,29 +3778,31 @@ cc.Class({
if (this.debugLayer.parent && this.debugLayer.active) {
// const rect = {
// x:- w/2,
// y: - h/ 2,
// width:w,
// height:h
// }
const rect = {
x:- w/2,
y: - h/ 2,
width:w,
height:h
}
// const colorDot = getSprNode(color);
const colorDot = getSprNode(color);
// colorDot.scaleX = rect.width / colorDot.width;
// colorDot.scaleY = rect.height / colorDot.height;
// node.addChild(colorDot);
colorDot.scaleX = rect.width / colorDot.width;
colorDot.scaleY = rect.height / colorDot.height;
node.addChild(colorDot);
node.anchorX = 0;
node.anchorY = 0;
node.x = x;
node.y = y;
node.scaleX = w / node.width;
node.scaleY = h / node.height;
// node.anchorX = 0;
// node.anchorY = 0;
// node.x = x;
// node.y = y;
// node.scaleX = w / node.width;
// node.scaleY = h / node.height;
this.debugDrawLayer.addChild(node);
}
......@@ -3794,8 +3810,13 @@ cc.Class({
node.y = y;
const rect = new cc.Rect(node.x -w/2, node.y -h/2, w, h);
node.dotRect = rect;
node.ccRect = rect;
return node;
},
......
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