fixed input
This commit is contained in:
		
							parent
							
								
									4746f34537
								
							
						
					
					
						commit
						7dd95f262c
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -13,6 +13,7 @@ const handleAngleMagnitude=(x, y, threshold=0, fn=null, clearBuffer=false) => {
 | 
				
			||||||
	const {angle, magnitude}=toAngleMagnitude(x, y);
 | 
						const {angle, magnitude}=toAngleMagnitude(x, y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(magnitude>threshold) {
 | 
						if(magnitude>threshold) {
 | 
				
			||||||
 | 
							let inputs=currentInputs;
 | 
				
			||||||
		if(angle>.25 && angle <.75) inputs.right=true;
 | 
							if(angle>.25 && angle <.75) inputs.right=true;
 | 
				
			||||||
		else if(angle>.75 && angle<1.25) inputs.up=true;
 | 
							else if(angle>.75 && angle<1.25) inputs.up=true;
 | 
				
			||||||
		else if(angle>1.25 && angle<1.75) inputs.left=true;
 | 
							else if(angle>1.25 && angle<1.75) inputs.left=true;
 | 
				
			||||||
| 
						 | 
					@ -69,7 +70,7 @@ const handleJoystick=(() => {
 | 
				
			||||||
				!config.touchscreen.buffer
 | 
									!config.touchscreen.buffer
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
});
 | 
					})();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const handleSwipe=(() => {
 | 
					const handleSwipe=(() => {
 | 
				
			||||||
	let center={
 | 
						let center={
 | 
				
			||||||
| 
						 | 
					@ -91,7 +92,7 @@ const handleSwipe=(() => {
 | 
				
			||||||
				!config.touchscreen.buffer
 | 
									!config.touchscreen.buffer
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
});
 | 
					})();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const handleGamepads={
 | 
					const handleGamepads={
 | 
				
			||||||
	frame: () => {
 | 
						frame: () => {
 | 
				
			||||||
| 
						 | 
					@ -111,6 +112,7 @@ const handleGamepads={
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const handleEvent=(type, evt) => {
 | 
					const handleEvent=(type, evt) => {
 | 
				
			||||||
	for(let handler of handlers) {
 | 
						for(let handler of handlers) {
 | 
				
			||||||
 | 
							console.log(type, handler);
 | 
				
			||||||
		let fn=handler[type];
 | 
							let fn=handler[type];
 | 
				
			||||||
		if(fn) fn(evt);
 | 
							if(fn) fn(evt);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue