fixed input

This commit is contained in:
Nathan DECHER 2020-04-05 18:22:37 +02:00
parent 4746f34537
commit 7dd95f262c

View file

@ -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);
}