Screen depends on window
This commit is contained in:
parent
1872c5cfdb
commit
8ee678ee48
2 changed files with 12 additions and 4 deletions
|
@ -55,8 +55,8 @@ h1 {
|
|||
#app {
|
||||
background: #000;
|
||||
position: absolute;
|
||||
width: 1000px;
|
||||
height: 600px;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
left:0;
|
||||
right:0;
|
||||
margin-left:auto;
|
||||
|
|
12
index.js
12
index.js
|
@ -32,8 +32,16 @@ function init() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function onOpen(evt) {
|
||||
function resize(){
|
||||
var app = document.getElementById('app');
|
||||
app.style.width = (window.innerWidth - 8) + 'px';
|
||||
app.style.height = (window.innerHeight - 4) + 'px';
|
||||
updateUser();
|
||||
}
|
||||
|
||||
function onOpen(evt) {
|
||||
resize();
|
||||
window.addEventListener('resize', resize, false);
|
||||
setInterval(poll, speed, true);
|
||||
}
|
||||
|
||||
|
@ -162,7 +170,7 @@ function drawRemove(line){
|
|||
function updateUser() {
|
||||
var myself = {
|
||||
name: myName,
|
||||
size: {width: window.innerWidth, height: window.innerHeight}
|
||||
size: {width: window.innerWidth - 8, height: window.innerHeight - 4}
|
||||
};
|
||||
var packet = {
|
||||
command: 'update user',
|
||||
|
|
Reference in a new issue