feat: implement useScreenClick

This commit is contained in:
2025-11-13 00:37:05 +01:00
parent c0eba9cfee
commit 4a8d46eb24
3 changed files with 64 additions and 0 deletions

View File

@@ -26,6 +26,24 @@ const nextBottomButton = ref<"downloadPlay" | "pictochat">("pictochat");
const selectorPosition = computed(() => BUTTONS_CONFIG[selectedButton.value]);
useScreenClick((x: number, y: number) => {
for (const [buttonName, config] of Object.entries(BUTTONS_CONFIG)) {
if (
x >= config.sx &&
x <= config.sx + config.sw &&
y >= config.sy &&
y <= config.sy + config.sh
) {
selectedButton.value = buttonName as ButtonType;
if (buttonName === "pictochat" || buttonName === "downloadPlay") {
nextBottomButton.value = buttonName;
}
break;
}
}
});
const handleKeyPress = (event: KeyboardEvent) => {
switch (event.key) {
case "ArrowUp":