Fix get Heigh&Width (#14)

This commit is contained in:
6543 2020-05-04 16:51:58 +02:00 committed by GitHub
parent 3fe81fd721
commit 14bc1517f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -2,8 +2,12 @@
var c = document.getElementById("c"); var c = document.getElementById("c");
var ctx = c.getContext("2d"); var ctx = c.getContext("2d");
//Get client offsets //Get client offsets
var my_height = document.getElementById("main_doc").offsetHeight; var my_height = "innerHeight" in window
var my_width = document.getElementById("home").offsetWidth; ? window.innerHeight
: document.documentElement.offsetHeight; ;
var my_width = "innerWidth" in window
? window.innerWidth
: document.documentElement.offsetWidth; ;
//making the canvas full screen //making the canvas full screen
c.height = my_height; c.height = my_height;