Skip to content

Commit 48cccc8

Browse files
committed
fix: refactor fullscreen toggle functionality to use the entire app container
1 parent 32f5b31 commit 48cccc8

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

js/app.js

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,40 @@ class ShelterAccessApp {
765765
* Toggle fullscreen functionality
766766
*/
767767
toggleFullscreen() {
768-
const mapContainer = document.getElementById('map');
769-
if (!document.fullscreenElement) {
770-
mapContainer.requestFullscreen?.() ||
771-
mapContainer.webkitRequestFullscreen?.() ||
772-
mapContainer.mozRequestFullScreen?.();
773-
} else {
774-
document.exitFullscreen?.() ||
775-
document.webkitExitFullscreen?.() ||
776-
document.mozCancelFullScreen?.();
768+
console.log('Fullscreen button clicked');
769+
try {
770+
// Use the entire app container instead of just the map
771+
const appContainer = document.getElementById('app');
772+
773+
if (!document.fullscreenElement) {
774+
console.log('Entering fullscreen mode');
775+
// Enter fullscreen
776+
if (appContainer.requestFullscreen) {
777+
appContainer.requestFullscreen();
778+
} else if (appContainer.webkitRequestFullscreen) {
779+
appContainer.webkitRequestFullscreen();
780+
} else if (appContainer.mozRequestFullScreen) {
781+
appContainer.mozRequestFullScreen();
782+
} else if (appContainer.msRequestFullscreen) {
783+
appContainer.msRequestFullscreen();
784+
} else {
785+
console.warn('Fullscreen not supported by this browser');
786+
}
787+
} else {
788+
console.log('Exiting fullscreen mode');
789+
// Exit fullscreen
790+
if (document.exitFullscreen) {
791+
document.exitFullscreen();
792+
} else if (document.webkitExitFullscreen) {
793+
document.webkitExitFullscreen();
794+
} else if (document.mozCancelFullScreen) {
795+
document.mozCancelFullScreen();
796+
} else if (document.msExitFullscreen) {
797+
document.msExitFullscreen();
798+
}
799+
}
800+
} catch (error) {
801+
console.error('Error toggling fullscreen:', error);
777802
}
778803
}
779804

0 commit comments

Comments
 (0)