feat(nds): don't display help button and hints on smaller screens (they can't click on the buttons anyway)

This commit is contained in:
2026-02-22 22:50:24 +01:00
parent 48688544f1
commit 28cd10bb08
2 changed files with 18 additions and 15 deletions

View File

@@ -1,23 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import gsap from "gsap"; import gsap from "gsap";
import { useWindowSize } from "@vueuse/core";
const app = useAppStore(); const app = useAppStore();
const ndsScale = ref(1); const windowSize = useWindowSize();
const hintsContainer = useTemplateRef<HTMLElement>("hintsContainer"); const hintsContainer = useTemplateRef("hintsContainer");
const updateScale = () => { const ndsScale = computed(() => {
const scaleX = (window.innerWidth - 40) / 235; const scaleX = (windowSize.width.value - 40) / 235;
const scaleY = (window.innerHeight - 40) / 431; const scaleY = (windowSize.height.value - 40) / 431;
ndsScale.value = Math.min(scaleX, scaleY); return Math.min(scaleX, scaleY);
};
onMounted(() => {
updateScale();
window.addEventListener("resize", updateScale);
});
onUnmounted(() => {
window.removeEventListener("resize", updateScale);
}); });
watch( watch(

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useWindowSize } from "@vueuse/core";
import gsap from "gsap"; import gsap from "gsap";
const { isReady } = useAssets(); const { isReady } = useAssets();
@@ -25,6 +26,16 @@ const toggleFullscreen = () => {
} }
}; };
const windowSize = useWindowSize();
watch([windowSize.width, windowSize.height], ([width, height]) => {
if (width / height > 614 / 667) {
app.allowHints();
} else {
app.disallowHints();
}
});
const helpButton = useTemplateRef("helpButton"); const helpButton = useTemplateRef("helpButton");
let helpAnimation: gsap.core.Timeline | null = null; let helpAnimation: gsap.core.Timeline | null = null;