forked from MapComplete/MapComplete
		
	Automatically zoom to GPS location if no coordinate is specified in the URL
This commit is contained in:
		
							parent
							
								
									dad579c895
								
							
						
					
					
						commit
						61b6721342
					
				
					 3 changed files with 17 additions and 9 deletions
				
			
		|  | @ -10,6 +10,7 @@ import Combine from "../../UI/Base/Combine"; | |||
| export class QueryParameters { | ||||
| 
 | ||||
|     private static order: string [] = ["layout", "test", "z", "lat", "lon"]; | ||||
|     private static _wasInitialized: Set<string> = new Set() | ||||
|     private static knownSources = {}; | ||||
|     private static initialized = false; | ||||
|     private static defaults = {} | ||||
|  | @ -91,6 +92,7 @@ export class QueryParameters { | |||
|                 const kv = param.split("="); | ||||
|                 const key = decodeURIComponent(kv[0]); | ||||
|                 QueryParameters.addOrder(key) | ||||
|                 QueryParameters._wasInitialized.add(key) | ||||
|                 const v = decodeURIComponent(kv[1]); | ||||
|                 const source = new UIEventSource<string>(v); | ||||
|                 source.addCallback(() => QueryParameters.Serialize()) | ||||
|  | @ -102,6 +104,10 @@ export class QueryParameters { | |||
|             console.log(QueryParameters.GenerateQueryParameterDocs()) | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     public static wasInitialized(key: string) : boolean{ | ||||
|         return QueryParameters._wasInitialized.has(key) | ||||
|     } | ||||
| 
 | ||||
|     private static Serialize() { | ||||
|         const parts = [] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue