|
1 | 1 | <script setup lang="ts"> |
2 | | -import { useIdle } from "@vueuse/core"; |
| 2 | +import { useIdle, useSessionStorage } from "@vueuse/core"; |
3 | 3 | import { onMounted, onUnmounted, provide } from "vue"; |
4 | 4 | import { type RouteLocationNormalized } from "vue-router"; |
5 | 5 | import { useRouter } from "vue-router"; |
| 6 | +import { useConsoleTheme } from "@/console/composables/useConsoleTheme"; |
6 | 7 | import { InputBus, InputBusSymbol } from "@/console/input/bus"; |
7 | 8 | import { attachGamepad } from "@/console/input/gamepad"; |
8 | 9 | import { attachKeyboard } from "@/console/input/keyboard"; |
9 | 10 | import { ROUTES } from "@/plugins/router"; |
10 | | -import { useConsoleTheme } from "@/stores/consoleTheme"; |
11 | 11 |
|
12 | 12 | const router = useRouter(); |
13 | 13 | const bus = new InputBus(); |
14 | 14 | const themeStore = useConsoleTheme(); |
15 | 15 | provide(InputBusSymbol, bus); |
16 | 16 |
|
| 17 | +const fullScreenPostPlay = useSessionStorage( |
| 18 | + "emulation.fullScreenPostPlay", |
| 19 | + false, |
| 20 | +); |
| 21 | +
|
17 | 22 | // Define route hierarchy for transition direction logic |
18 | 23 | const routeHierarchy = { |
19 | 24 | [ROUTES.CONSOLE_HOME]: 0, |
20 | 25 | [ROUTES.CONSOLE_PLATFORM]: 1, |
21 | 26 | [ROUTES.CONSOLE_COLLECTION]: 1, |
| 27 | + [ROUTES.CONSOLE_SMART_COLLECTION]: 1, |
| 28 | + [ROUTES.CONSOLE_VIRTUAL_COLLECTION]: 1, |
22 | 29 | [ROUTES.CONSOLE_ROM]: 2, |
23 | 30 | [ROUTES.CONSOLE_PLAY]: 3, |
24 | 31 | }; |
@@ -58,6 +65,14 @@ onMounted(() => { |
58 | 65 | bus.pushScope(); |
59 | 66 | detachKeyboard = attachKeyboard(bus); |
60 | 67 | detachGamepad = attachGamepad(bus); |
| 68 | +
|
| 69 | + // Re-enable fullscreen if it was enabled after exiting the game |
| 70 | + if (fullScreenPostPlay.value) { |
| 71 | + document.documentElement.requestFullscreen?.().catch((error) => { |
| 72 | + console.error("Error requesting fullscreen", error); |
| 73 | + }); |
| 74 | + fullScreenPostPlay.value = false; |
| 75 | + } |
61 | 76 | }); |
62 | 77 |
|
63 | 78 | onUnmounted(() => { |
|
0 commit comments