forked from MapComplete/MapComplete
		
	Fix touch direction input
This commit is contained in:
		
							parent
							
								
									4737a6f56c
								
							
						
					
					
						commit
						e2881840da
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -62,7 +62,9 @@ export default class DirectionInput extends InputElement<string> { | |||
| 
 | ||||
| 
 | ||||
|         htmlElement.ontouchmove = (ev: TouchEvent) => { | ||||
|             console.log("Getting a touch", ev.touches[0].clientX, ev.touches[0].clientY) | ||||
|             onPosChange(ev.touches[0].clientX, ev.touches[0].clientY); | ||||
|             ev.preventDefault(); | ||||
|         } | ||||
| 
 | ||||
|         let isDown = false; | ||||
|  |  | |||
							
								
								
									
										10
									
								
								test.ts
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								test.ts
									
										
									
									
									
								
							|  | @ -5,9 +5,15 @@ import Direction from "./UI/Input/DirectionInput"; | |||
| import {UIEventSource} from "./Logic/UIEventSource"; | ||||
| import {VariableUiElement} from "./UI/Base/VariableUIElement"; | ||||
| 
 | ||||
| const d = new UIEventSource(90); | ||||
| const d = new UIEventSource("90"); | ||||
| new Direction(d).AttachTo("maindiv") | ||||
| new VariableUiElement(d.map(d => ""+d+"°")).AttachTo("extradiv") | ||||
| new VariableUiElement(d.map(d => "" + d + "°")).AttachTo("extradiv") | ||||
| 
 | ||||
| UIEventSource.Chronic(25, () => { | ||||
|     const degr = (Number(d.data) + 1) % 360; | ||||
|     d.setData(""+ degr); | ||||
|     return true; | ||||
| }) | ||||
| 
 | ||||
| /*/ | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue