修改界面自适应

This commit is contained in:
sunzhenyu 2019-08-07 11:28:46 +08:00
parent 7edaf938c7
commit 5899fe1347
5 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,12 @@
export function SetRender(dom) {
console.log(dom.clientWidth);
console.log(dom.clientHeight);
console.log(dom.innerWidth);
console.log(dom.innerHeight);
console.log(dom.offsetWidth);
console.log(dom.offsetHeight);
var renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setSize(dom.clientWidth, dom.clientHeight);
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
//renderer.setSize( window.innerWidth, window.innerHeight );
return renderer;
}

View File

@ -48,7 +48,9 @@ export function JLmapDriving(dom, data,skinStyle) {
this.animateswitch = false;
//初始化webgl渲染
let renderer = SetRender(dom);
dom.appendChild(renderer.domElement);
renderer.domElement.style.position = "absolute";
renderer.domElement.style.top = "0";
document.getElementById('jlsimulation').appendChild(renderer.domElement);
//定义相机
let camera = SetCamera(dom);
//定义场景(渲染容器)

View File

@ -48,7 +48,9 @@ export function JLmap3d(dom, data,skinStyle) {
this.animateswitch = false;
//初始化webgl渲染
let renderer = SetRender(dom);
dom.appendChild(renderer.domElement);
renderer.domElement.style.position = "absolute";
renderer.domElement.style.top = "0";
document.getElementById('testjlmap3d').appendChild(renderer.domElement);
//定义相机
let camera = SetCamera(dom);
//定义场景(渲染容器)

View File

@ -116,7 +116,7 @@
},
init: function (skinStyle) {
let mapdata = this.$store.getters['map/map'];
let dom = document.getElementById('testjlmap3d');
let dom = document.getElementById('app');
this.jlmap3d = new JLmap3d(dom, mapdata, skinStyle);
this.jlmap3d.eventon();
},
@ -227,8 +227,6 @@
}
#testjlmap3d {
width: 937px;
height: 937px;
}
.jalmap3ddiv {
@ -244,7 +242,8 @@
//left:20%;
width: 100%;
height: 100%;
z-index: 0;
position:absolute;
z-index: -1;
}
#canvastexture {

View File

@ -160,7 +160,7 @@
},
init: function (skinStyle) {
let mapdata = this.$store.getters['map/map'];
let dom = document.getElementById('jlsimulation');
let dom = document.getElementById('app');
this.jlmap3d = new JLmapDriving(dom, mapdata, skinStyle);
this.jlmap3d.eventon();
@ -291,7 +291,8 @@
//left:20%;
width: 100%;
height: 100%;
z-index: 0;
position:absolute;
z-index: -1;
}
#canvastexture {