experimental mobile touchscreen support for oneko

This commit is contained in:
cybrneko 2025-05-10 22:20:36 -05:00
parent 89cb563793
commit e971a3d7ab

View File

@ -105,11 +105,19 @@
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;
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);
}