Merge pull request #12 from H4CK3R-01/fix_scale_problem

Fixed scale problem
This commit is contained in:
H4CK3R-01 2021-06-10 11:31:01 +02:00 committed by GitHub
commit d47ca1be66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,10 +197,24 @@ function generate_circle(graphics, x, y) {
} }
function calculate_size() { function calculate_size() {
if (game.offsetWidth > game.offsetHeight) { let width;
return game.offsetHeight; let height;
if (game.offsetWidth > window.innerWidth) {
width = window.innerWidth - document.getElementById('chat').offsetWidth;
} else { } else {
return game.offsetWidth; width = game.offsetWidth;
}
if (game.offsetHeight > window.innerHeight) {
height = window.innerHeight - document.getElementsByTagName('header')[0].offsetHeight;
} else {
height = game.offsetHeight;
}
if (width > height) {
return height;
} else {
return width;
} }
} }