| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   import { Store, UIEventSource } from "../../../Logic/UIEventSource"; | 
					
						
							|  |  |  |   import type { MapProperties } from "../../../Models/MapProperties"; | 
					
						
							|  |  |  |   import { Map as MlMap } from "maplibre-gl"; | 
					
						
							|  |  |  |   import { MapLibreAdaptor } from "../../Map/MapLibreAdaptor"; | 
					
						
							|  |  |  |   import MaplibreMap from "../../Map/MaplibreMap.svelte"; | 
					
						
							|  |  |  |   import DragInvitation from "../../Base/DragInvitation.svelte"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * A visualisation to pick a direction on a map background | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   export let value: UIEventSource<{lon: number, lat: number}>; | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |   export let mapProperties: Partial<MapProperties> & { readonly location: UIEventSource<{ lon: number; lat: number }> } = undefined; | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2023-04-14 02:42:57 +02:00
										 |  |  |    * Called when setup is done, can be used to add more layers to the map | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |    */ | 
					
						
							|  |  |  |   export let onCreated : (value: Store<{lon: number, lat: number}> , map: Store<MlMap>, mapProperties: MapProperties ) => void | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |   export let map: UIEventSource<MlMap> = new UIEventSource<MlMap>(undefined); | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |   let mla = new MapLibreAdaptor(map, mapProperties); | 
					
						
							| 
									
										
										
										
											2023-04-14 02:42:57 +02:00
										 |  |  |   mapProperties.location.syncWith(value) | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |   if(onCreated){ | 
					
						
							|  |  |  |     onCreated(value, map, mla) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  | <div class="relative h-full min-h-32 cursor-pointer overflow-hidden"> | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |   <div class="w-full h-full absolute top-0 left-0 cursor-pointer"> | 
					
						
							|  |  |  |     <MaplibreMap {map} attribution={false}></MaplibreMap> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |   <div class="w-full h-full absolute top-0 left-0 p-8 pointer-events-none opacity-50 flex items-center"> | 
					
						
							|  |  |  |     <img src="./assets/svg/move-arrows.svg" class="h-full max-h-24"/> | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  |   </div> | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |   <DragInvitation hideSignal={mla.location.stabilized(3000)}></DragInvitation> | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | </div> |