From 7dd95f262c078909ff8f2b1910a40a24a84c4ae7 Mon Sep 17 00:00:00 2001 From: Nathan DECHER Date: Sun, 5 Apr 2020 18:22:37 +0200 Subject: [PATCH] fixed input --- src/js/input.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/input.js b/src/js/input.js index cc3dbd8..f1fc3b5 100644 --- a/src/js/input.js +++ b/src/js/input.js @@ -13,6 +13,7 @@ const handleAngleMagnitude=(x, y, threshold=0, fn=null, clearBuffer=false) => { const {angle, magnitude}=toAngleMagnitude(x, y); if(magnitude>threshold) { + let inputs=currentInputs; if(angle>.25 && angle <.75) inputs.right=true; else if(angle>.75 && angle<1.25) inputs.up=true; else if(angle>1.25 && angle<1.75) inputs.left=true; @@ -69,7 +70,7 @@ const handleJoystick=(() => { !config.touchscreen.buffer ) } -}); +})(); const handleSwipe=(() => { let center={ @@ -91,7 +92,7 @@ const handleSwipe=(() => { !config.touchscreen.buffer ) } -}); +})(); const handleGamepads={ frame: () => { @@ -111,6 +112,7 @@ const handleGamepads={ const handleEvent=(type, evt) => { for(let handler of handlers) { + console.log(type, handler); let fn=handler[type]; if(fn) fn(evt); }