Commit 4ad4086f authored by linzhiguo's avatar linzhiguo

# 选项进入分组判断过宽

# 宽小高大的图片缩放问题
parent 0ffa12fd
...@@ -7778,7 +7778,7 @@ ...@@ -7778,7 +7778,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-682, -921.831,
0, 0,
0, 0,
0, 0,
...@@ -7872,7 +7872,7 @@ ...@@ -7872,7 +7872,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-575, -814.831,
0, 0,
0, 0,
0, 0,
...@@ -7966,7 +7966,7 @@ ...@@ -7966,7 +7966,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-468, -707.831,
0, 0,
0, 0,
0, 0,
...@@ -8060,7 +8060,7 @@ ...@@ -8060,7 +8060,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-361, -600.831,
0, 0,
0, 0,
0, 0,
...@@ -8154,7 +8154,7 @@ ...@@ -8154,7 +8154,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-254, -493.831,
0, 0,
0, 0,
0, 0,
...@@ -8248,7 +8248,7 @@ ...@@ -8248,7 +8248,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-147, -386.831,
0, 0,
0, 0,
0, 0,
......
...@@ -264,6 +264,7 @@ cc.Class({ ...@@ -264,6 +264,7 @@ cc.Class({
this._touched = true; this._touched = true;
selected.copyValues(option); selected.copyValues(option);
selected.selected(true); selected.selected(true);
selected.selectedSize();
selected.target = option_node; selected.target = option_node;
selected.cx = selected.node.x; selected.cx = selected.node.x;
selected.cy = selected.node.y; selected.cy = selected.node.y;
...@@ -301,15 +302,18 @@ cc.Class({ ...@@ -301,15 +302,18 @@ cc.Class({
if (!this._touched) if (!this._touched)
return; return;
let item, len = this._kind_group.node.childrenCount; let item, area, len = this._kind_group.node.childrenCount;
let i = 0; let i = 0;
for(i = 0; i < len; i++){ for(i = 0; i < len; i++){
item = this._kind_group.node.children[i]; item = this._kind_group.node.children[i];
if (cc.rect(item.getBoundingBoxToWorld()).intersects(cc.rect(selected.node.getBoundingBoxToWorld()))){ area = item.getChildByName('layout_area');
console.log(i); let rect = area.getBoundingBoxToWorld();
console.log(item.getBoundingBoxToWorld()); rect.width -= 20;
rect.x += 10;
if (cc.rect(rect).intersects(cc.rect(selected.node.getBoundingBoxToWorld()))){
// console.log(i);
// console.log(item.getBoundingBoxToWorld());
let kind = item.getComponent(cc.js.getClassByName('WordKind')); let kind = item.getComponent(cc.js.getClassByName('WordKind'));
if (kind.kind_id != selected.kind_id){ if (kind.kind_id != selected.kind_id){
//this.playAudioByName('incorrect'); //this.playAudioByName('incorrect');
......
...@@ -140,6 +140,15 @@ cc.Class({ ...@@ -140,6 +140,15 @@ cc.Class({
} }
}, },
selectedSize(){
if (this._type == 0){
this.node.width = 256;
}
else{
this.node.width = 321;
}
},
changeBackground(){ changeBackground(){
let type = this._type; let type = this._type;
let fname; let fname;
......
...@@ -23,7 +23,7 @@ export function setSpriteWH(target, sf, w, h){ ...@@ -23,7 +23,7 @@ export function setSpriteWH(target, sf, w, h){
target.node.height = vv; target.node.height = vv;
} }
if (osize.width > w && osize.width > osize.height){ if (osize.width > osize.height){
let wr = w/osize.width; let wr = w/osize.width;
target.node.width = w; target.node.width = w;
target.node.height = wr * osize.height; target.node.height = wr * osize.height;
...@@ -36,7 +36,7 @@ export function setSpriteWH(target, sf, w, h){ ...@@ -36,7 +36,7 @@ export function setSpriteWH(target, sf, w, h){
} }
} }
if (osize.height > h && osize.width < osize.height){ if (osize.width < osize.height){
let hr = h/osize.height; let hr = h/osize.height;
target.node.width = hr * osize.width; target.node.width = hr * osize.width;
target.node.height = h; target.node.height = h;
......
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