Skip to content

Commit 6c175b3

Browse files
Fix: remove black empty space in fullscreen mode (#5774) (#5775)
1 parent 6fa4eef commit 6c175b3

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

css/activities.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ div.back:active {
514514
position: absolute;
515515
top: 0;
516516
left: 0;
517+
518+
height: calc(var(--vh, 1vh) * 100);
517519
}
518520

519521
.canvasHolder.hide {
@@ -628,7 +630,7 @@ nav ul li {
628630

629631
#planet-iframe {
630632
width: 100vw;
631-
height: 100vh;
633+
height: calc(var(--vh, 1vh) * 100);
632634
background-color: #fff;
633635
position: absolute;
634636
top: 0;
@@ -638,6 +640,8 @@ nav ul li {
638640
iframe,
639641
canvas {
640642
overflow: clip !important;
643+
width: 100%;
644+
height: 100%;
641645
}
642646

643647
.projectname {

index.html

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
</noscript>
136136
<header>
137137
<div id="loading-image-container"
138-
style="position: fixed; top: 0; left: 0; width: 100%; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #FFFFFF; z-index: 9999; contain: paint;">
138+
style="position: fixed; top: 0; left: 0; width: 100%; height: calc(var(--vh) * 100); display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #FFFFFF; z-index: 9999; contain: paint;">
139139
<div id="loading-media" style="width: 100%; padding: 0 20px; box-sizing: border-box;"></div>
140140
<div class="loading-text" id="loadingText"
141141
style="color:#333; margin-top: 2rem; min-height: 1.5em; font-size: 1.2rem;">
@@ -190,7 +190,7 @@
190190
<label for="fixed">Fixed</label>
191191
</div>
192192
<!-- #92B5C8 width = 3790 height = 1743-->
193-
<canvas id="canvas" width="100%" height="100%" style="background-color:#FFFFFF; width:100%;"></canvas>
193+
<canvas id="canvas" style="background-color:#FFFFFF; width:100%; height:100%;"></canvas>
194194

195195
<!--hidden at the beginning whilst everything loads-->
196196
<div id="hideContents" style="display: none;" tabindex="-1">
@@ -946,7 +946,39 @@
946946
window.addEventListener("resize", togglePlayOnlyMode);
947947
});
948948

949-
</script>
949+
(function () {
950+
function setAppHeight() {
951+
const vh = window.innerHeight * 0.01;
952+
document.documentElement.style.setProperty('--vh', `${vh}px`);
953+
}
954+
955+
window.addEventListener('resize', setAppHeight);
956+
document.addEventListener('fullscreenchange', setAppHeight);
957+
setAppHeight();
958+
})();
959+
960+
(function () {
961+
function resizeCanvasesToScreen() {
962+
const canvases = document.querySelectorAll("canvas");
963+
const width = window.innerWidth;
964+
const height = window.innerHeight;
965+
966+
canvases.forEach(c => {
967+
c.width = width;
968+
c.height = height;
969+
c.style.width = "100%";
970+
c.style.height = "100%";
971+
});
972+
}
973+
974+
window.addEventListener("resize", resizeCanvasesToScreen);
975+
document.addEventListener("fullscreenchange", resizeCanvasesToScreen);
976+
977+
setTimeout(resizeCanvasesToScreen, 150);
978+
})();
979+
980+
</script>
981+
950982

951983
</body>
952984

0 commit comments

Comments
 (0)