| 
									
										
										
										
											2023-09-21 15:29:34 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Show nearby images which can be clicked | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   import type { OsmTags } from "../../Models/OsmFeature" | 
					
						
							|  |  |  |   import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  |   import type { SpecialVisualizationState } from "../SpecialVisualization" | 
					
						
							|  |  |  |   import type { P4CPicture } from "../../Logic/Web/NearbyImagesSearch" | 
					
						
							|  |  |  |   import NearbyImagesSearch from "../../Logic/Web/NearbyImagesSearch" | 
					
						
							|  |  |  |   import LinkableImage from "./LinkableImage.svelte" | 
					
						
							|  |  |  |   import type { Feature } from "geojson" | 
					
						
							|  |  |  |   import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | 
					
						
							|  |  |  |   import Loading from "../Base/Loading.svelte" | 
					
						
							|  |  |  |   import AllImageProviders from "../../Logic/ImageProviders/AllImageProviders" | 
					
						
							|  |  |  |   import Tr from "../Base/Tr.svelte" | 
					
						
							|  |  |  |   import Translations from "../i18n/Translations" | 
					
						
							|  |  |  |   import LoginToggle from "../Base/LoginToggle.svelte" | 
					
						
							| 
									
										
										
										
											2023-09-16 02:30:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-11 15:22:45 +01:00
										 |  |  |   export let tags: UIEventSource<OsmTags> | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   export let state: SpecialVisualizationState | 
					
						
							|  |  |  |   export let lon: number | 
					
						
							|  |  |  |   export let lat: number | 
					
						
							|  |  |  |   export let feature: Feature | 
					
						
							| 
									
										
										
										
											2023-09-16 02:30:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   export let linkable: boolean = true | 
					
						
							|  |  |  |   export let layer: LayerConfig | 
					
						
							| 
									
										
										
										
											2023-09-16 02:30:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   let imagesProvider = new NearbyImagesSearch( | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       lon, | 
					
						
							|  |  |  |       lat, | 
					
						
							|  |  |  |       allowSpherical: new UIEventSource<boolean>(false), | 
					
						
							| 
									
										
										
										
											2024-06-20 04:21:29 +02:00
										 |  |  |       blacklist: AllImageProviders.LoadImagesFor(tags), | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |     }, | 
					
						
							|  |  |  |     state.indexedFeatures | 
					
						
							|  |  |  |   ) | 
					
						
							| 
									
										
										
										
											2023-09-16 02:30:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   let images: Store<P4CPicture[]> = imagesProvider.store.map((images) => images.slice(0, 20)) | 
					
						
							|  |  |  |   let allDone = imagesProvider.allDone | 
					
						
							| 
									
										
										
										
											2023-09-16 02:30:01 +02:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-18 03:33:11 +02:00
										 |  |  | <div class="flex justify-between"> | 
					
						
							|  |  |  |   <h4> | 
					
						
							|  |  |  |     <Tr t={Translations.t.image.nearby.title} /> | 
					
						
							|  |  |  |   </h4> | 
					
						
							|  |  |  |   <slot name="corner" /> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | {#if !$allDone} | 
					
						
							|  |  |  |   <Loading /> | 
					
						
							|  |  |  | {:else if $images.length === 0} | 
					
						
							|  |  |  |   <Tr t={Translations.t.image.nearby.noNearbyImages} cls="alert" /> | 
					
						
							|  |  |  | {:else} | 
					
						
							|  |  |  |   <div class="flex w-full space-x-1 overflow-x-auto" style="scroll-snap-type: x proximity"> | 
					
						
							|  |  |  |     {#each $images as image (image.pictureUrl)} | 
					
						
							| 
									
										
										
										
											2024-06-20 04:21:29 +02:00
										 |  |  |       <span class="w-fit shrink-0" style="scroll-snap-align: start"> | 
					
						
							|  |  |  |         <LinkableImage {tags} {image} {state} {feature} {layer} {linkable} /> | 
					
						
							|  |  |  |       </span> | 
					
						
							| 
									
										
										
										
											2024-06-18 03:33:11 +02:00
										 |  |  |     {/each} | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | {/if} |