Commit a466d631 authored by 范雪寒's avatar 范雪寒

feat: fix none 适配

parent 774e1f7e
...@@ -715,6 +715,25 @@ cc.Class({ ...@@ -715,6 +715,25 @@ cc.Class({
this.node.y = (this.node.height * this.node.scale) / 2; this.node.y = (this.node.height * this.node.scale) / 2;
return; return;
} }
if (!canvasComponent.fitHeight && !canvasComponent.fitWidth) {
console.log("fit none");
const scale = Math.max(
designSize.width / canvasSize.width,
designSize.height / canvasSize.height
);
const scaleHeight = this.node.height / canvasSize.height;
this.node.width = canvasSize.width * scaleHeight;
this.node.scale = scale / scaleHeight;
const pos = this.node.parent.convertToNodeSpaceAR(
canvas.convertToWorldSpaceAR(cc.v2(0, 0))
);
this.node.setPosition(pos);
return;
}
}, },
loadBundleByConf(conf, callback) { loadBundleByConf(conf, callback) {
......
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