Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
wildfirecode13
xiaoxiaole
Commits
aa013c7b
Commit
aa013c7b
authored
May 26, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善webview适配
parent
b84a4daa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
WebView.ts
egret/src/webview/WebView.ts
+20
-6
No files found.
egret/src/webview/WebView.ts
View file @
aa013c7b
...
@@ -99,13 +99,27 @@ export default class WebView extends egret.DisplayObjectContainer {
...
@@ -99,13 +99,27 @@ export default class WebView extends egret.DisplayObjectContainer {
var
canvas
=
document
.
getElementsByTagName
(
"canvas"
)[
0
];
var
canvas
=
document
.
getElementsByTagName
(
"canvas"
)[
0
];
var
canvas_wid
=
canvas
.
width
;
var
canvas_wid
=
canvas
.
width
;
var
canvas_hei
=
canvas
.
height
;
var
canvas_hei
=
canvas
.
height
;
// if(canvas_wid<990){
console
.
log
(
"原大小"
,
canvas_wid
,
canvas_hei
);
var
nscale
:
number
=
1
;
if
(
canvas_wid
<
990
){
console
.
log
(
"小于990,使用新适配方案"
);
// canvas_hei = canvas_hei*990/canvas_wid;
// canvas_hei = canvas_hei*990/canvas_wid;
// canvas_wid = 990;
// canvas_wid = 990;
// }
nscale
=
canvas_wid
/
990
;
canvas_hei
=
canvas_hei
*
(
990
/
canvas_wid
);
canvas_wid
=
990
;
console
.
log
(
"新大小"
,
canvas_wid
,
canvas_hei
);
}
else
{
console
.
log
(
"使用canvas默认适配"
);
}
this
.
_iframe
.
width
=
this
.
_iframeWrapper
.
style
.
width
=
canvas_wid
+
"px"
;
this
.
_iframe
.
width
=
this
.
_iframeWrapper
.
style
.
width
=
canvas_wid
+
"px"
;
this
.
_iframe
.
height
=
this
.
_iframeWrapper
.
style
.
height
=
canvas_hei
+
"px"
;
this
.
_iframe
.
height
=
this
.
_iframeWrapper
.
style
.
height
=
canvas_hei
+
"px"
;
console
.
log
(
"新缩放"
)
this
.
_iframeWrapper
.
style
.
transform
=
"matrix("
+
nscale
+
", 0, 0, "
+
nscale
+
", 0, 0)"
;
this
.
_iframeWrapper
.
style
[
'transform-origin'
]
=
"0% 0% 0px"
;
console
.
log
(
"iframe大小"
,
this
.
_iframe
.
width
,
this
.
_iframe
.
height
);
console
.
log
(
"iframe大小"
,
this
.
_iframe
.
width
,
this
.
_iframe
.
height
);
this
.
closebtn
=
document
.
createElement
(
"img"
);
this
.
closebtn
=
document
.
createElement
(
"img"
);
this
.
closebtn
.
src
=
"http://yun.duiba.com.cn/aurora/assets/571906f5a3b59d6e654e6522c916ed1707231551.png"
;
this
.
closebtn
.
src
=
"http://yun.duiba.com.cn/aurora/assets/571906f5a3b59d6e654e6522c916ed1707231551.png"
;
...
...
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