Commit 6c925a21 authored by 范雪寒's avatar 范雪寒

feat:

parent ecd5b4a4
...@@ -441,9 +441,9 @@ cc.Class({ ...@@ -441,9 +441,9 @@ cc.Class({
designSize.height / canvasSize.height designSize.height / canvasSize.height
); );
this.node.width = canvasSize.width; const scaleHeight = this.node.height / canvasSize.height;
this.node.height = canvasSize.height; this.node.width = canvasSize.width * scaleHeight;
this.node.scale = scale; this.node.scale = scale / scaleHeight;
const pos = this.node.parent.convertToNodeSpaceAR( const pos = this.node.parent.convertToNodeSpaceAR(
canvas.convertToWorldSpaceAR(cc.v2(0, 0)) canvas.convertToWorldSpaceAR(cc.v2(0, 0))
...@@ -456,11 +456,11 @@ cc.Class({ ...@@ -456,11 +456,11 @@ cc.Class({
console.log("fit height"); console.log("fit height");
const scale = designSize.height / canvasSize.height; const scale = designSize.height / canvasSize.height;
this.node.width = canvasSize.width; const scaleHeight = this.node.height / canvasSize.height;
this.node.height = canvasSize.height; this.node.width = canvasSize.width * scaleHeight;
this.node.scale = scale; this.node.scale = scale / scaleHeight;
this.node.x = (this.node.width * scale) / 2; this.node.x = (this.node.width * this.node.scale) / 2;
this.node.y = (this.node.height * scale) / 2; this.node.y = (this.node.height * this.node.scale) / 2;
return; return;
} }
...@@ -468,11 +468,11 @@ cc.Class({ ...@@ -468,11 +468,11 @@ cc.Class({
console.log("fit width"); console.log("fit width");
const scale = designSize.width / canvasSize.width; const scale = designSize.width / canvasSize.width;
this.node.width = canvasSize.width; const scaleWidth = this.node.width / canvasSize.width;
this.node.height = canvasSize.height; this.node.height = canvasSize.height * scaleWidth;
this.node.scale = scale; this.node.scale = scale / scaleWidth;
this.node.x = (this.node.width * scale) / 2; this.node.x = (this.node.width * this.node.scale) / 2;
this.node.y = (this.node.height * scale) / 2; this.node.y = (this.node.height * this.node.scale) / 2;
return; return;
} }
}, },
......
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