2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script lang="ts">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   * The visual feedback panel gives visual (and auditive) feedback on the main map view
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import Translations from "../i18n/Translations"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import ThemeViewState from "../../Models/ThemeViewState"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import Summary from "./Summary.svelte"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import Tr from "../Base/Tr.svelte"
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import { UIEventSource } from "../../Logic/UIEventSource"
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import type { KeyNavigationEvent } from "../../Models/MapProperties"
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import MapCenterDetails from "./MapCenterDetails.svelte"
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  export let state: ThemeViewState
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-20 02:50:08 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const t = Translations.t.general.visualFeedback
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let map = state.mapProperties
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  let centerFeatures = state.closestFeatures.features
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-30 15:24:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let translationWithLength = centerFeatures
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .mapD((cf) => cf.length)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .mapD((n) => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (n === 1) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return t.oneFeatureInView
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return t.closestFeaturesAre.Subs({ n })
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    })
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 01:46:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let lastAction: UIEventSource<KeyNavigationEvent> = new UIEventSource<KeyNavigationEvent>(
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-30 15:24:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    undefined
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 01:46:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  )
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  state.mapProperties.onKeyNavigationEvent((event) => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    lastAction.setData(event)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  })
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 01:46:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  lastAction.stabilized(750).addCallbackAndRunD((_) => lastAction.setData(undefined))
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-30 15:24:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<div aria-live="assertive" class="m-1 rounded bg-white p-1">
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {#if $lastAction?.key === "out"}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-30 15:24:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <Tr t={t.out.Subs({ z: map.zoom.data - 1 })} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {:else if $lastAction?.key === "in"}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-30 15:24:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <Tr t={t.out.Subs({ z: map.zoom.data + 1 })} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {:else if $lastAction !== undefined}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-20 02:50:08 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <Tr t={t[$lastAction.key]} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {:else if $centerFeatures?.length === 0}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-20 02:50:08 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <Tr t={t.noCloseFeatures} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <MapCenterDetails {state} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {:else if $centerFeatures !== undefined}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <div class="pointer-events-auto">
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      <Tr t={$translationWithLength} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      <MapCenterDetails {state} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-24 05:01:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      <div class="grid grid-cols-3 space-x-1 space-y-0.5">
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-21 17:36:43 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        {#each $centerFeatures.slice(0, 9) as feat, i (feat.properties.id)}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-24 05:01:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          <Summary {state} feature={feat} {i} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {/each}
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-24 05:01:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      </div>
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 01:46:01 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {/if}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</div>
							 |