diff --git a/src/components/big-interactive-pages/desktop-player.module.css b/src/components/big-interactive-pages/desktop-player.module.css index 5479a71644..105187eed9 100644 --- a/src/components/big-interactive-pages/desktop-player.module.css +++ b/src/components/big-interactive-pages/desktop-player.module.css @@ -2,19 +2,37 @@ display: flex; align-items: center; justify-content: center; - position: fixed; /* TODO: this is bad! figure out how to make better */ - top: 0; - height: 100vh; - width: 100vw; + width: 100%; + height: 100%; + flex: 1; + min-height: 0; } .root { display: flex; - margin: 20px + margin: 20px; + max-width: 100%; + max-height: 100%; + align-items: center; + justify-content: center; } .screenContainer { position: relative; + display: flex; + flex-direction: column; + align-items: center; + max-height: 100%; + max-width: 100%; +} + +.canvasWrapper { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; + max-height: 100%; + min-height: 0; } .screen { @@ -25,7 +43,13 @@ aspect-ratio: 1000 / 800; image-rendering: pixelated; outline: none; - width: 100%; + width: auto; + max-width: 100%; + max-height: min(800px, calc(100vh - 120px)); +} + +.embedded .screen { + max-height: min(800px, calc(100vh - 250px)); } .screenControls { @@ -37,7 +61,6 @@ gap: 10px; align-items: center; padding: 8px 0; - position: absolute; width: 100%; } @@ -49,35 +72,82 @@ margin-left: 30px; } -@media all and (display-mode: fullscreen) { - .screenControls { - display: none; - } - - .screenContainer { - display: flex; - flex-direction: column; - align-items: center; - } - - .screen { - border: none; - height: 100%; - width: unset - } - - .canvasWrapper { - height: 100%; - } - - .screenControls.enabled { - display: flex; - position: relative; - bottom: 0; - width: 100%; - background: var(--bg-base); - padding: 8px 20px; - } +.screenContainer:fullscreen { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background: #000000; + width: 100vw; + height: 100vh; +} + +.screenContainer:-webkit-full-screen { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background: #000000; + width: 100vw; + height: 100vh; +} + +.screenContainer:fullscreen .screenControls { + display: none; +} + +.screenContainer:-webkit-full-screen .screenControls { + display: none; +} + +.screenContainer:fullscreen .screen { + border: none; + width: min(100%, calc(100vh * 1.25)); + height: min(100%, calc(100vw * 0.8)); + aspect-ratio: 1000 / 800; + max-height: 100%; + max-width: 100%; +} + +.screenContainer:-webkit-full-screen .screen { + border: none; + width: min(100%, calc(100vh * 1.25)); + height: min(100%, calc(100vw * 0.8)); + aspect-ratio: 1000 / 800; + max-height: 100%; + max-width: 100%; +} + +.screenContainer:fullscreen .canvasWrapper { + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.screenContainer:-webkit-full-screen .canvasWrapper { + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.screenContainer:fullscreen .screenControls.enabled { + display: flex; + position: absolute; + bottom: 0; + width: 100%; + background: var(--bg-base); + padding: 8px 20px; +} + +.screenContainer:-webkit-full-screen .screenControls.enabled { + display: flex; + position: absolute; + bottom: 0; + width: 100%; + background: var(--bg-base); + padding: 8px 20px; } .screenControls .mute, diff --git a/src/components/big-interactive-pages/desktop-player.tsx b/src/components/big-interactive-pages/desktop-player.tsx index 3136e53fca..06b835e065 100644 --- a/src/components/big-interactive-pages/desktop-player.tsx +++ b/src/components/big-interactive-pages/desktop-player.tsx @@ -30,6 +30,7 @@ interface DesktopPlayerProps { filename: string isLoggedIn: boolean hearted: boolean + embedded?: boolean } export default function DesktopPlayer(props: DesktopPlayerProps) { @@ -159,7 +160,7 @@ export default function DesktopPlayer(props: DesktopPlayerProps) { }); return ( -