fix: hide help buttons on screen too small to click on physical buttons
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from "@vueuse/core";
|
||||
import gsap from "gsap";
|
||||
import { LazyLagModal } from "#components";
|
||||
|
||||
@@ -30,20 +29,6 @@ const bottomScreenCanvas = computed(() => bottomScreen.value?.canvas ?? null);
|
||||
const isTouchDevice = () =>
|
||||
"ontouchstart" in window || navigator.maxTouchPoints > 0;
|
||||
|
||||
const windowSize = useWindowSize();
|
||||
|
||||
watch(
|
||||
[windowSize.width, windowSize.height],
|
||||
([width, height]) => {
|
||||
if (width / height > 614 / 667) {
|
||||
if (app.booted) app.allowHints();
|
||||
} else {
|
||||
app.disallowHints();
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const helpButton = useTemplateRef("helpButton");
|
||||
let helpAnimation: gsap.core.Timeline | null = null;
|
||||
|
||||
@@ -105,11 +90,16 @@ const hideHelpLabels = () => {
|
||||
});
|
||||
};
|
||||
|
||||
// help button is removed when hints are disallowed, no need to animate it out
|
||||
watch(
|
||||
() => app.hintsAllowed,
|
||||
(allowed) => {
|
||||
if (!allowed) hideHelpLabels();
|
||||
if (allowed) return;
|
||||
helpAnimation?.kill();
|
||||
helpAnimation = null;
|
||||
app.hintsVisible = false;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -129,9 +119,7 @@ onMounted(async () => {
|
||||
});
|
||||
}
|
||||
|
||||
const scaleX = (window.innerWidth - 40) / 235;
|
||||
const scaleY = (window.innerHeight - 40) / 431;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
const scale = getNDS2DScale(window.innerWidth, window.innerHeight);
|
||||
|
||||
if (app.settings.renderingMode === "2d" && scale < 1) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user