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

feat: 屏幕适配

parent 9adff6a1
This diff is collapsed.
......@@ -84,7 +84,6 @@ cc.Class({
this.initView();
this.initListener();
this.showLetterAnimation();
this.startEditMode();
},
......@@ -118,6 +117,26 @@ cc.Class({
this.updateLetterBtnLabel();
this.addDrawLetter(this.letter);
cc.find('Canvas').on('size-changed', () => {
this.onSizeChanged();
});
this.onSizeChanged();
},
onSizeChanged() {
this.node.getComponent(cc.Widget).updateAlignment();
const currentSize = { width: this.node.width, height: this.node.height };
console.log('currentSize = ' + JSON.stringify(currentSize));
const frameSize = cc.view.getFrameSize();
console.log('frameSize = ' + JSON.stringify(frameSize));
const designSize = cc.view.getDesignResolutionSize();
console.log('designSize = ' + JSON.stringify(designSize));
const letterBg = cc.find('Canvas/bg/Img_letter_bg');
const scale = (designSize.width / designSize.height) / (frameSize.width / frameSize.height);
letterBg.scale = Math.min(scale, 1);
},
updateLetterBtnLabel() {
......
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