Commit 769b4651 authored by linzhiguo's avatar linzhiguo

# layout 增加子项超宽引起外层node.size异常

# 改善选项命中
parent c7976f06
......@@ -227,7 +227,7 @@ cc.Class({
cc.find('Canvas/show').on('click', ()=>{
let item = cc.instantiate(this._kind_group.template_node);
this._kind_group.node.addChild(item);
item.y = 43;
item.y = 80;
this._kind_group.updateView();
});
......@@ -296,7 +296,8 @@ cc.Class({
return;
let item, len = this._kind_group.node.childrenCount;
for(let i = 0; i < len; i++){
let i = 0;
for(i = 0; i < len; i++){
item = this._kind_group.node.children[i];
if (cc.rect(item.getBoundingBoxToWorld()).intersects(cc.rect(selected.node.getBoundingBoxToWorld()))){
console.log(i);
......@@ -305,8 +306,9 @@ cc.Class({
let kind = item.getComponent(cc.js.getClassByName('WordKind'));
if (kind.kind_id != selected.kind_id){
this.playAudioByName('incorrect');
break;
//this.playAudioByName('incorrect');
//break;
continue;
}
this.playAudioByName('correct');
let node = cc.instantiate(cc.find('res/option_item'));
......@@ -330,6 +332,9 @@ cc.Class({
break;
}
}
if (i == len){
this.playAudioByName('incorrect');
}
this._moved = true;
this._touched = false;
if (selected.target){
......
......@@ -128,6 +128,12 @@ cc.Class({
node.width*=sr;
node.height*=sr;
node.scale *= sr;
if (node.width > this.node.width - 50){
sr = (this.node.width - 50)/node.width;
node.width*=sr;
node.height*=sr;
node.scale *= sr;
}
// node.opacity = 0;
option.adjustPicSize();
cb && cb();
......
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