try enter fullscreen on start

This commit is contained in:
Viktor Rådberg
2023-08-26 18:37:39 +02:00
parent 074d8b0f5f
commit 51e9056eac

View File

@@ -103,6 +103,7 @@ const Start = ({
if (!initialGameSettings) {
return;
}
document.documentElement.requestFullscreen();
setInitialGameSettings(initialGameSettings);
setPlayers(createInitialPlayers(initialGameSettings));
};
@@ -115,14 +116,6 @@ const Start = ({
return `${value}`;
};
const toggleFullscreen = () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else if (document.exitFullscreen) {
document.exitFullscreen();
}
};
const getDefaultLayout = (numberOfPlayers: number) => {
switch (numberOfPlayers) {
case 1:
@@ -213,18 +206,6 @@ const Start = ({
setPlayerOptions({ ...playerOptions, gridAreas })
}
/>
<Button
style={{
marginTop: '0.5rem',
marginRight: 'auto',
marginLeft: 'auto',
}}
size="small"
variant="contained"
onClick={toggleFullscreen}
>
Toggle fullscreen
</Button>
</FormControl>
<StartButtonFooter>
<Button