Commit 33fdf405 authored by asdf's avatar asdf

监听窗口大小

parent aea79427
......@@ -433,15 +433,31 @@
"_id": "55rwu0gPVCAo5OMVIR4UaO"
},
{
"__type__": "e22e11e0CVGPajfhd4ljXke",
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"FitType": 1,
"_id": "28YDFuER9OG4BNuSEmzfGn"
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "cboBsxPVxCs7o8oy4lGz2l"
},
{
"__type__": "cc.Node",
......@@ -2889,15 +2905,31 @@
"_id": "21D3mlX0ZIeKDtow2Zj3Lc"
},
{
"__type__": "e22e11e0CVGPajfhd4ljXke",
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"FitType": 1,
"_id": "d2d7tWj1RCkoGmGJOQgkXO"
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "d8ARWEkthP9Lw2KhEu2d0T"
},
{
"__type__": "cc.Canvas",
......@@ -2982,7 +3014,7 @@
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
......@@ -2995,8 +3027,8 @@
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "d8oKEvhO9LT4T0A9yfsl+M"
}
]
\ No newline at end of file
......@@ -18,6 +18,14 @@ cc.Class({
},
onLoad: function () {
cc.view.on('canvas-resize', this.refreshFit, this)
this.refreshFit();
},
onDestroy(){
cc.view.off('canvas-resize', this.refreshFit, this)
},
refreshFit() {
if (this.FitType == FitType.Scale) {
let winSize = cc.view.getFrameSize();
let scale1 = designSize.width / designSize.height;
......
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