Skip to content

Commit 5de3664

Browse files
fix vehicle list disappearing in certain conditions
1 parent 14bcbd6 commit 5de3664

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

js/app.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,19 @@ var callsign = "";
276276

277277
function checkSize() {
278278
// we are in landscape mode
279-
w = $(window).width();
279+
w = window.innerWidth;
280+
281+
// this is hacky fix for off by 1px that makes the vechicle list disappear
282+
wrect = document.body.getBoundingClientRect();
283+
// chrome seems to calculate the body bounding box differently from every other browser
284+
if (!!window.chrome) {
285+
w_fix = (wrect.width === Math.floor(wrect.width)) ? 1 : 0;
286+
} else {
287+
w_fix = (w === Math.floor(wrect.width)) ? 0 : 1;
288+
}
289+
280290
w = (w < 320) ? 320 : w; // absolute minimum 320px
281-
h = $(window).height();
291+
h = window.innerHeight;
282292
//h = (h < 300) ? 300 : h; // absolute minimum 320px minus 20px for the iphone bar
283293
hh = $('header').height();
284294

@@ -293,7 +303,7 @@ function checkSize() {
293303

294304
$("#mapscreen,.flatpage").height(h-hh-5);
295305

296-
sw = (wvar.vlist) ? 199 : 0;
306+
sw = (wvar.vlist) ? 200 : 0;
297307

298308
$('.container').width(w-20);
299309

@@ -305,7 +315,7 @@ function checkSize() {
305315
$('#map').height(h-hh-5);
306316
}
307317
$('body,#loading').height(h);
308-
$('#mapscreen,#map,#telemetry_graph,#telemetry_graph .holder').width(w-sw-ph);
318+
$('#mapscreen,#map,#telemetry_graph,#telemetry_graph .holder').width(w-sw-ph-w_fix);
309319
$('#main').width(sw);
310320
} else { // portrait mode
311321
//if(h < 420) h = 420;

0 commit comments

Comments
 (0)