Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chooseWord
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
chooseWord
Commits
33fdf405
Commit
33fdf405
authored
Dec 01, 2020
by
asdf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监听窗口大小
parent
aea79427
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
13 deletions
+53
-13
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+41
-9
NodeFitScreen.js
play/assets/tmpGame/script/NodeFitScreen.js
+12
-4
No files found.
play/assets/tmpGame/scene/Scene.fire
View file @
33fdf405
...
...
@@ -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":
128
0,
"_originalHeight":
72
0,
"_id": "d8oKEvhO9LT4T0A9yfsl+M"
}
]
\ No newline at end of file
play/assets/tmpGame/script/NodeFitScreen.js
View file @
33fdf405
...
...
@@ -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
;
...
...
@@ -34,15 +42,15 @@ cc.Class({
this
.
node
.
height
=
visiblesize
.
height
;
}
else
if
(
this
.
FitType
==
FitType
.
FullHeight
)
{
let
visiblesize
=
cc
.
view
.
getVisibleSize
();
let
scale
=
visiblesize
.
width
/
this
.
node
.
width
;
let
scale
=
visiblesize
.
width
/
this
.
node
.
width
;
this
.
node
.
width
=
scale
*
this
.
node
.
width
;
this
.
node
.
height
=
scale
*
this
.
node
.
height
;
}
else
if
(
this
.
FitType
==
FitType
.
FullWidth
)
{
}
else
if
(
this
.
FitType
==
FitType
.
FullWidth
)
{
let
visiblesize
=
cc
.
view
.
getVisibleSize
();
let
scale
=
visiblesize
.
height
/
this
.
node
.
height
;
let
scale
=
visiblesize
.
height
/
this
.
node
.
height
;
this
.
node
.
width
=
scale
*
this
.
node
.
width
;
this
.
node
.
height
=
scale
*
this
.
node
.
height
;
}
else
{
}
else
{
let
wsize
=
cc
.
view
.
getFrameSize
();
let
scaleW
=
wsize
.
width
/
designSize
.
width
;
let
scaleH
=
wsize
.
height
/
designSize
.
height
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment