From b8f43d7db418974f14284d2913e4ae4179cf7830 Mon Sep 17 00:00:00 2001 From: GINOFM Date: Fri, 9 Jan 2026 16:33:12 -0300 Subject: [PATCH] fix(touch): reduce more the stutter on mobile - Added preventDefault() listeners on touchstart, touchend and touchmove - Used { passive: false } to prevent browser default passive behavior --- scripts/_GameMaker.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/_GameMaker.js b/scripts/_GameMaker.js index ff520a7d..f415a6a7 100644 --- a/scripts/_GameMaker.js +++ b/scripts/_GameMaker.js @@ -827,10 +827,14 @@ function GameMaker_Init() }); /* ...this helps with eliminating stutter on mobile */ - document.addEventListener('touchstart', e => { - e.preventDefault(); - }, { - passive: false + canvas.addEventListener("touchstart", (e) => e.preventDefault(), { + passive: false, + }); + canvas.addEventListener("touchmove", (e) => e.preventDefault(), { + passive: false, + }); + canvas.addEventListener("touchend", (e) => e.preventDefault(), { + passive: false, }); g_FrameStartTime = Date.now();