Commit aa013c7b authored by zjz1994's avatar zjz1994

完善webview适配

parent b84a4daa
......@@ -98,14 +98,28 @@ export default class WebView extends egret.DisplayObjectContainer {
// this._iframe.height = this._iframeWrapper.style.height = this._windowH+"px";
var canvas = document.getElementsByTagName("canvas")[0];
var canvas_wid = canvas.width;
var canvas_hei = canvas.height;
// if(canvas_wid<990){
// canvas_hei = canvas_hei*990/canvas_wid;
// canvas_wid = 990;
// }
var canvas_hei = canvas.height;
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_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.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);
this.closebtn = document.createElement("img");
this.closebtn.src = "http://yun.duiba.com.cn/aurora/assets/571906f5a3b59d6e654e6522c916ed1707231551.png";
......
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