put the preventElementZoom call into a method instead to call it from anywhere/anytime we import it (#1515)

This commit is contained in:
Greenlamp2 2024-05-28 23:22:32 +02:00 committed by GitHub
parent a163a420bd
commit 0385a90f08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,8 @@ export const keysDown = new Map();
let lastTouchedId;
export function initTouchControls(buttonMap) {
const dpadDiv = document.querySelector("#dpad");
preventElementZoom(dpadDiv);
for (const button of document.querySelectorAll("[data-key]")) {
// @ts-ignore
bindKey(button, button.dataset.key, buttonMap);
@ -138,6 +140,3 @@ function preventElementZoom(element) {
event.target.click();
});
}
const dpadDiv = document.querySelector("#dpad");
preventElementZoom(dpadDiv);