Commit c0ab34d3 authored by linzhiguo's avatar linzhiguo

# 图片选项缩放

parent 5625a4f2
...@@ -631,6 +631,7 @@ cc.Class({ ...@@ -631,6 +631,7 @@ cc.Class({
this._xs[i%2] -= (i < 2 ? item._w/2 : item._w); this._xs[i%2] -= (i < 2 ? item._w/2 : item._w);
item.x = this._xs[i%2]; item.x = this._xs[i%2];
item.y = this._ys[i%2]; item.y = this._ys[i%2];
op.adjustPicSize();
} }
}, },
......
export const defaultData = export const defaultData =
{"stars":[{"id":"16239922308635wok5p"},{"id":"1623992233278l9trhw"}],"pages":[{"id":"1623992235665ryt80q","star_id":"16239922308635wok5p"},{"id":"1623992246832rwwxwc","star_id":"16239922308635wok5p"},{"id":"1624506193914ksvus9","star_id":"1623992233278l9trhw"}],"kinds":[{"id":"1623981972242lokdmj","word":"aaa","page_id":"1623992235665ryt80q","pic_url":"http://staging-teach.cdn.ireadabc.com/9fe5243645c4d48f5ccddcac67e1808e.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/dd360bbbcf5817eea26ac5fa3341ef5d.mp3","is_text":false,"options":[{"is_text":false,"audio_url":"http://staging-teach.cdn.ireadabc.com/a812f773f22fdb5fa0de04bc7979f6d7.mp3","pic_url":"http://staging-teach.cdn.ireadabc.com/9475b713f231acb63a2f1defa1c358d8.jpeg"},{"is_text":false,"audio_url":"http://staging-teach.cdn.ireadabc.com/f228f396d2007fc20ab07763ebeda22e.mp3","pic_url":"http://staging-teach.cdn.ireadabc.com/6c04a4211a3664f64dcda68f027f1f40.jpeg"}]},{"id":"1623988481981dyiqg7","word":"bbb","page_id":"1623992235665ryt80q","pic_url":"http://staging-teach.cdn.ireadabc.com/7c1537fcf875cc782235ddebfa0d5d72.jpg","is_text":false,"options":[{"is_text":true,"word":"b1"},{"is_text":false,"pic_url":"http://staging-teach.cdn.ireadabc.com/bc67a6550d9b566aa61eafc3634f752e.jpg"}]},{"options":[{"is_text":true,"word":"rrr"},{"is_text":true,"word":"tewre"}],"is_disturb":true,"is_text":true,"id":"16245126704047qu7b3","page_id":"1623992235665ryt80q"},{"options":[{"is_text":true,"word":"d1dddddddddddddd"},{"is_text":true,"word":"d2"},{"is_text":true,"word":"d3"}],"is_disturb":false,"is_text":true,"id":"1624512683708wxep60","page_id":"1623992246832rwwxwc","word":"","audio_url":"http://staging-teach.cdn.ireadabc.com/738ef124b1882d10b31d59fb2fbd7eb7.mp3"},{"options":[{"is_text":true,"word":"e1"},{"is_text":true,"word":"e2"},{"is_text":true,"word":"e3"}],"is_disturb":false,"is_text":true,"id":"1624512725657lqqj3r","page_id":"1623992246832rwwxwc","word":"eeeeeeeeeeeeeeeeeeeeeeeeeeee"},{"options":[{"is_text":true,"word":"4rt3"},{"is_text":true,"word":"435634"}],"is_disturb":true,"is_text":true,"id":"1624512754647ip8vce","page_id":"1623992246832rwwxwc"},{"options":[{"is_text":true,"word":"r1"},{"is_text":true,"word":"r2"},{"is_text":true,"word":"r3"}],"is_disturb":false,"is_text":true,"id":"16245127738549dpkjr","page_id":"1624506193914ksvus9","word":"rrrrrrrrrrrrrrrr"},{"options":[{"is_text":true,"word":"y1"},{"is_text":true,"word":"y2"},{"is_text":true,"word":"y3"}],"is_disturb":false,"is_text":true,"id":"1624512800217fvnv04","page_id":"1624506193914ksvus9","word":"yyyyyyyyyy"},{"options":[{"is_text":true,"word":"434"},{"is_text":true,"word":"43534"},{"is_text":true,"word":"43543"}],"is_disturb":false,"is_text":true,"id":"1624512822668sab0sk","page_id":"1624506193914ksvus9","word":"weewrwe"},{"options":[{"is_text":true,"word":"eeee"},{"is_text":true,"word":"ert34t"}],"is_disturb":true,"is_text":true,"id":"162451695910372kqqy","page_id":"1624506193914ksvus9","word":"werwrwe"}],"options":null,"audio_url":"http://staging-teach.cdn.ireadabc.com/f228f396d2007fc20ab07763ebeda22e.mp3"} {"stars":[{"id":"16239922308635wok5p"},{"id":"1623992233278l9trhw"}],"pages":[{"id":"1623992235665ryt80q","star_id":"16239922308635wok5p"},{"id":"1623992246832rwwxwc","star_id":"16239922308635wok5p"},{"id":"1624506193914ksvus9","star_id":"1623992233278l9trhw"}],"kinds":[{"id":"1623981972242lokdmj","word":"aaa","page_id":"1623992235665ryt80q","pic_url":"http://staging-teach.cdn.ireadabc.com/5edde6ded73dc7397b0ad901ff96df12.png","audio_url":"http://staging-teach.cdn.ireadabc.com/dd360bbbcf5817eea26ac5fa3341ef5d.mp3","is_text":false,"options":[{"is_text":true,"word":"aaa1"},{"is_text":true,"word":"a2"}]},{"options":[{"is_text":true,"word":"rrrr"},{"is_text":true,"word":"tewre"},{"is_text":false,"pic_url":"http://staging-teach.cdn.ireadabc.com/5edde6ded73dc7397b0ad901ff96df12.png"}],"is_disturb":false,"is_text":true,"id":"16245126704047qu7b3","page_id":"1623992235665ryt80q","word":"222222"},{"options":[{"is_text":true,"word":"d1dddddddddddddd"},{"is_text":true,"word":"d2"},{"is_text":true,"word":"d3"}],"is_disturb":false,"is_text":true,"id":"1624512683708wxep60","page_id":"1623992246832rwwxwc","word":"","audio_url":"http://staging-teach.cdn.ireadabc.com/738ef124b1882d10b31d59fb2fbd7eb7.mp3"},{"options":[{"is_text":true,"word":"e1"},{"is_text":true,"word":"e2"},{"is_text":true,"word":"e3"}],"is_disturb":false,"is_text":true,"id":"1624512725657lqqj3r","page_id":"1623992246832rwwxwc","word":"eeeeeeeeeeeeeeeeeeeeeeeeeeee"},{"options":[{"is_text":true,"word":"4rt3"},{"is_text":true,"word":"435634"}],"is_disturb":true,"is_text":true,"id":"1624512754647ip8vce","page_id":"1623992246832rwwxwc"},{"options":[{"is_text":true,"word":"r1"},{"is_text":true,"word":"r2"},{"is_text":true,"word":"r3"}],"is_disturb":false,"is_text":true,"id":"16245127738549dpkjr","page_id":"1624506193914ksvus9","word":"rrrrrrrrrrrrrrrr"},{"options":[{"is_text":true,"word":"y1"},{"is_text":true,"word":"y2"},{"is_text":true,"word":"y3"}],"is_disturb":false,"is_text":true,"id":"1624512800217fvnv04","page_id":"1624506193914ksvus9","word":"yyyyyyyyyy"},{"options":[{"is_text":true,"word":"434"},{"is_text":true,"word":"43534"},{"is_text":true,"word":"43543"}],"is_disturb":false,"is_text":true,"id":"1624512822668sab0sk","page_id":"1624506193914ksvus9","word":"weewrwe"},{"options":[{"is_text":true,"word":"eeee"},{"is_text":true,"word":"ert34t"}],"is_disturb":true,"is_text":true,"id":"162451695910372kqqy","page_id":"1624506193914ksvus9","word":"werwrwe"}],"options":null,"audio_url":"http://staging-teach.cdn.ireadabc.com/f228f396d2007fc20ab07763ebeda22e.mp3"}
export const defaultData1= { export const defaultData1= {
......
...@@ -61,16 +61,14 @@ cc.Class({ ...@@ -61,16 +61,14 @@ cc.Class({
resetWH(){ resetWH(){
if (this._type == 0){ if (this._type == 0){
this.node.width = this.pic_finish.width;
this.node.height = this.pic_finish.height;
this.pic.node.x = -this.pic_node.x; this.pic.node.x = -this.pic_node.x;
this.pic.node.y = -this.pic_node.y; this.pic.node.y = -this.pic_node.y;
this.node.width = this.pic_node.width; this.node.width = this.pic_node.width;
this.node.height = this.pic_node.height; this.node.height = this.pic_node.height;
this.pic.width = this.node.width;
this.pic.height = this.node.height;
} }
else if (this._type == 1){ else if (this._type == 1){
this.node.width = this.word_finish.width;
this.node.height = this.word_finish.height;
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;
......
...@@ -17,6 +17,12 @@ export function setSpriteWH(target, sf, w, h){ ...@@ -17,6 +17,12 @@ export function setSpriteWH(target, sf, w, h){
target.spriteFrame = sf; target.spriteFrame = sf;
let osize = sf.getOriginalSize(); let osize = sf.getOriginalSize();
if (osize.width == osize.height){
let vv = Math.min(w,h);
target.node.width = vv;
target.node.height = vv;
}
if (osize.width > w && osize.width > osize.height){ if (osize.width > w && osize.width > osize.height){
let wr = w/osize.width; let wr = w/osize.width;
target.node.width = w; target.node.width = w;
......
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