From 024f766cfc6e045b06eea677807122f9b52e07eb Mon Sep 17 00:00:00 2001 From: Keryan Didier Date: Fri, 31 May 2024 12:35:46 +0200 Subject: [PATCH] prevent event lockup --- src/stubs/ml_canvas.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/stubs/ml_canvas.js b/src/stubs/ml_canvas.js index 416e7bb..dcaf5dc 100644 --- a/src/stubs/ml_canvas.js +++ b/src/stubs/ml_canvas.js @@ -1589,10 +1589,10 @@ function ml_canvas_init() { if (_ml_canvas_initialized === true) { return 0; } - document.onkeydown = _key_down_handler; - document.onkeyup = _key_up_handler; - document.onmouseup = _up_handler; - document.onmousemove = _move_handler; + document.addEventListener("keydown", _key_down_handler, {passive: true}); + document.addEventListener("keyup", _key_up_handler, {passive: true}); + document.addEventListener("mouseup", _up_handler, {passive: true}); + document.addEventListener("mousemove", _move_handler, {passive: true}); window.requestAnimationFrame(_frame_handler); _ml_canvas_initialized = true; return 0;