Andreas Gysin 2023-01-31 23:19:57 +01:00
commit 8846f2e033
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -140,6 +140,18 @@ export function run(program, runSettings, userData = {}) {
pointer.pressed = false
eventQueue.push('pointerUp')
})
const touchHandler = e => {
const rect = settings.element.getBoundingClientRect()
pointer.x = e.touches[0].clientX - rect.left
pointer.y = e.touches[0].clientY - rect.top
eventQueue.push('pointerMove')
}
settings.element.addEventListener('touchmove', touchHandler)
settings.element.addEventListener('touchstart', touchHandler)
settings.element.addEventListener('touchend', touchHandler)
// CSS fix
settings.element.style.fontStrech = 'normal'