Commit c1bcece7 authored by linzhiguo's avatar linzhiguo

# 图片选项与文字选项混排重叠

parent 4317d267
...@@ -556,7 +556,7 @@ ...@@ -556,7 +556,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1280, "width": 1280,
"height": 540 "height": 530
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -568,7 +568,7 @@ ...@@ -568,7 +568,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-640, -640,
117, 121.50000000000003,
0, 0,
0, 0,
0, 0,
...@@ -660,11 +660,11 @@ ...@@ -660,11 +660,11 @@
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
"_target": null, "_target": null,
"_alignFlags": 45, "_alignFlags": 41,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 180, "_bottom": 185.5,
"_verticalCenter": 0, "_verticalCenter": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
...@@ -673,7 +673,7 @@ ...@@ -673,7 +673,7 @@
"_isAbsBottom": true, "_isAbsBottom": true,
"_isAbsHorizontalCenter": true, "_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 1277, "_originalWidth": 1280,
"_originalHeight": 530, "_originalHeight": 530,
"_id": "70gNgjcRhGR75pT/PBUfxW" "_id": "70gNgjcRhGR75pT/PBUfxW"
}, },
......
...@@ -205,15 +205,16 @@ cc.Class({ ...@@ -205,15 +205,16 @@ cc.Class({
console.log(this.data); console.log(this.data);
this._speed = Math.max(2,2/1280*this._frameSize.width);
this._test = cc.find('Canvas/test'); this._test = cc.find('Canvas/test');
this._move_area = cc.find('Canvas/move_area'); this._move_area = cc.find('Canvas/move_area');
this._kind_group = cc.find('Canvas/fg/kind').getComponent(cc.js.getClassByName('KindGroup')); this._kind_group = cc.find('Canvas/fg/kind').getComponent(cc.js.getClassByName('KindGroup'));
this._move_area.height = this._frameSize.height - 260; this._move_area.height = this._frameSize.height - 260;
let h1 = this._frameSize.height - 260 - 216*2;
let s1 = h1/3;
let offy = 216/2;
let offy = 216/2;
this._ys = [-offy, offy]; this._ys = [-offy, offy];
// let option_node = cc.find('res/option'); // let option_node = cc.find('res/option');
...@@ -333,7 +334,7 @@ cc.Class({ ...@@ -333,7 +334,7 @@ cc.Class({
// }) // })
// .start(); // .start();
this._xs[i%2] += selected.target._w; //this._xs[i%2] += selected.target._w;
selected.target.removeFromParent(); selected.target.removeFromParent();
selected.target = null; selected.target = null;
...@@ -699,19 +700,47 @@ cc.Class({ ...@@ -699,19 +700,47 @@ cc.Class({
if (!this._moved) if (!this._moved)
return; return;
let speed = 2; let speed = this._speed;
let area = this._move_area; let area = this._move_area;
this._xs[0] += speed; // this._xs[0] += speed;
this._xs[1] += speed; // this._xs[1] += speed;
for(let i = 0; i < area.childrenCount; i++){ let item, len = area.childrenCount;
let item = area.children[i]; for(let i = 0; i < len; i++){
item = area.children[i];
item.x += speed; item.x += speed;
if (item.x > this._frameSize.width + item._w){ if (item.x - item._w/2 + item._xoff> area.width){
this._xs[i%2] -= item._w; //this._xs[i%2] -= item._w;
item.x = Math.min(-item._w/2, this._xs[i%2]); //item.x = Math.min(-item._w/2, this._xs[i%2]);
//item.x = -item._w/2; //item.x = -item._w/2;
item.x = Math.min(-item._w/2, this.getLastX(i));
} }
} }
}, },
getLastX(idx){
let row = idx%2;
let area = this._move_area;
let obj = area.children[idx];
let mx = obj.x, mi = -1;
let item, len = area.childrenCount;
for(let i = row; i < len; i+=(row+1)){
item = area.children[i];
if (mx > item.x){
mx = item.x;
mi = i;
}
}
let ret = 0;
if (mi >= 0){
ret = mx - obj._w/2 - area.children[mi]._w/2;
}
console.log(ret);
return ret;
}
}); });
...@@ -54,7 +54,7 @@ cc.Class({ ...@@ -54,7 +54,7 @@ cc.Class({
this.word_node.active = type == 1; this.word_node.active = type == 1;
this.word.node.active = type == 1; this.word.node.active = type == 1;
this.word_finish.active = false; this.word_finish.active = false;
this.node._w = [345, 420][type]; this.node._w = [360, 420][type];
this.resetWH(); this.resetWH();
this.changeBackground(); this.changeBackground();
}, },
...@@ -67,12 +67,14 @@ cc.Class({ ...@@ -67,12 +67,14 @@ cc.Class({
this.node.height = this.pic_node.height; this.node.height = this.pic_node.height;
this.pic.width = this.node.width; this.pic.width = this.node.width;
this.pic.height = this.node.height; this.pic.height = this.node.height;
this.node._xoff = this.pic_node.x;
} }
else if (this._type == 1){ else if (this._type == 1){
this.node.width = this.word_node.width; this.node.width = this.word_node.width;
this.node.height = this.word_node.height; this.node.height = this.word_node.height;
// this.word.node.x = -this.word_node.x; // this.word.node.x = -this.word_node.x;
// this.word.node.y = -this.word_node.y; // this.word.node.y = -this.word_node.y;
this.node._xoff = this.word_node.x;
} }
}, },
......
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