| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   import type { SpecialVisualizationState } from "../SpecialVisualization" | 
					
						
							|  |  |  |   import type { Feature } from "geojson" | 
					
						
							|  |  |  |   import SelectedElementView from "../BigComponents/SelectedElementView.svelte" | 
					
						
							|  |  |  |   import SelectedElementTitle from "../BigComponents/SelectedElementTitle.svelte" | 
					
						
							|  |  |  |   import UserRelatedState from "../../Logic/State/UserRelatedState" | 
					
						
							|  |  |  |   import { LastClickFeatureSource } from "../../Logic/FeatureSource/Sources/LastClickFeatureSource" | 
					
						
							|  |  |  |   import Loading from "./Loading.svelte" | 
					
						
							|  |  |  |   import { onDestroy } from "svelte" | 
					
						
							| 
									
										
										
										
											2024-08-23 02:16:24 +02:00
										 |  |  |   import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | 
					
						
							|  |  |  |   import { GeocodingUtils } from "../../Logic/Geocoding/GeocodingProvider" | 
					
						
							|  |  |  |   import ThemeViewState from "../../Models/ThemeViewState" | 
					
						
							| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   export let state: SpecialVisualizationState | 
					
						
							|  |  |  |   export let selected: Feature | 
					
						
							|  |  |  |   let tags = state.featureProperties.getStore(selected.properties.id) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   export let absolute = true | 
					
						
							| 
									
										
										
										
											2024-08-23 02:16:24 +02:00
										 |  |  |   function getLayer(properties: Record<string, string>): LayerConfig { | 
					
						
							|  |  |  |     return state.getMatchingLayer(properties) | 
					
						
							| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   let layer = getLayer(selected.properties) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   let stillMatches = tags.map( | 
					
						
							|  |  |  |     (tags) => !layer?.source?.osmTags || layer?.source?.osmTags?.matchesProperties(tags) | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  |   onDestroy( | 
					
						
							| 
									
										
										
										
											2024-08-09 16:55:08 +02:00
										 |  |  |     stillMatches.addCallbackAndRunD((matches) => { | 
					
						
							| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  |       if (matches) { | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       /* | 
					
						
							|  |  |  |        * This is a workaround. Normally, we would dynamically rewrite 'layer' and this should update the view. | 
					
						
							|  |  |  |        * However, because there are quite some legacy elements and some elements have a different layer calculation, | 
					
						
							|  |  |  |        * we simply close the popup and open it again. | 
					
						
							|  |  |  |        * See #1956 | 
					
						
							| 
									
										
										
										
											2024-08-09 16:55:08 +02:00
										 |  |  |        */ | 
					
						
							| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  |       state.selectedElement.setData(undefined) | 
					
						
							|  |  |  |       requestAnimationFrame(() => { | 
					
						
							|  |  |  |         state.selectedElement.setData(selected) | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {#if !$stillMatches} | 
					
						
							|  |  |  |   <Loading /> | 
					
						
							|  |  |  | {:else} | 
					
						
							| 
									
										
										
										
											2024-08-09 16:55:08 +02:00
										 |  |  |   <div class="normal-background flex h-full w-full flex-col" class:absolute> | 
					
						
							| 
									
										
										
										
											2024-07-22 17:24:30 +02:00
										 |  |  |     <SelectedElementTitle {state} {layer} selectedElement={selected} /> | 
					
						
							|  |  |  |     <SelectedElementView {state} {layer} selectedElement={selected} /> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | {/if} |