mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: fullscreen disabling on old browsers
This commit is contained in:
1 parent
7e1949ccc7
commit
512134162d
1 file changed
+15
-12
@@ -19,6 +19,7 @@ export function Options({ isFullScreen, canvas }: OptionsProps) {
|
||||
const greenPenetration = useTankopedia(
|
||||
(state) => state.model.visual.greenPenetration,
|
||||
);
|
||||
const fullScreenAvailable = document.fullscreenEnabled;
|
||||
|
||||
return (
|
||||
<Flex
|
||||
@@ -61,18 +62,20 @@ export function Options({ isFullScreen, canvas }: OptionsProps) {
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Root>
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
if (isFullScreen) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
canvas.current?.requestFullscreen();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{isFullScreen ? <ExitFullScreenIcon /> : <EnterFullScreenIcon />}
|
||||
</Button>
|
||||
{fullScreenAvailable && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
if (isFullScreen) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
canvas.current?.requestFullscreen();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{isFullScreen ? <ExitFullScreenIcon /> : <EnterFullScreenIcon />}
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user