experimental mobile touchscreen support for oneko
This commit is contained in:
parent
89cb563793
commit
e971a3d7ab
@ -105,11 +105,19 @@
|
|||||||
|
|
||||||
document.body.appendChild(nekoEl);
|
document.body.appendChild(nekoEl);
|
||||||
|
|
||||||
document.addEventListener("mousemove", function (event) {
|
// Attach event listeners for both desktop and mobile
|
||||||
|
document.addEventListener('mousemove', function (event) {
|
||||||
mousePosX = event.clientX;
|
mousePosX = event.clientX;
|
||||||
mousePosY = event.clientY;
|
mousePosY = event.clientY;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener('touchmove', function (event) {
|
||||||
|
// Use the first touch point (primary touch)
|
||||||
|
const touch = event.touches[0];
|
||||||
|
mousePosX = touch.clientX;
|
||||||
|
mousePosY = touch.clientY;
|
||||||
|
}, { passive: false }); // Allow preventing default if needed
|
||||||
|
|
||||||
window.requestAnimationFrame(onAnimationFrame);
|
window.requestAnimationFrame(onAnimationFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user