forked from MapComplete/MapComplete
Chore: regenerate docs, lint
This commit is contained in:
parent
7b41b617f6
commit
bad0edd4b0
201 changed files with 6044 additions and 1750 deletions
|
|
@ -17,31 +17,48 @@
|
|||
let map = state.mapProperties
|
||||
|
||||
let currentLocation = state.geolocation.geolocationState.currentGPSLocation
|
||||
let distanceToCurrentLocation: Store<{ distance: string, distanceInMeters: number, bearing: number }> = map.location.mapD(({ lon, lat }) => {
|
||||
const current = currentLocation.data
|
||||
if (!current) {
|
||||
return undefined
|
||||
}
|
||||
const gps: [number, number] = [current.longitude, current.latitude]
|
||||
const mapCenter: [number, number] = [lon, lat]
|
||||
const distanceInMeters = Math.round(GeoOperations.distanceBetween(gps, mapCenter))
|
||||
const distance = GeoOperations.distanceToHuman(distanceInMeters)
|
||||
const bearing = Math.round(GeoOperations.bearing(gps, mapCenter))
|
||||
const bearingDirection = GeoOperations.bearingToHuman(bearing)
|
||||
return { distance, bearing, distanceInMeters, bearingDirection }
|
||||
}, [currentLocation])
|
||||
let distanceToCurrentLocation: Store<{
|
||||
distance: string
|
||||
distanceInMeters: number
|
||||
bearing: number
|
||||
}> = map.location.mapD(
|
||||
({ lon, lat }) => {
|
||||
const current = currentLocation.data
|
||||
if (!current) {
|
||||
return undefined
|
||||
}
|
||||
const gps: [number, number] = [current.longitude, current.latitude]
|
||||
const mapCenter: [number, number] = [lon, lat]
|
||||
const distanceInMeters = Math.round(GeoOperations.distanceBetween(gps, mapCenter))
|
||||
const distance = GeoOperations.distanceToHuman(distanceInMeters)
|
||||
const bearing = Math.round(GeoOperations.bearing(gps, mapCenter))
|
||||
const bearingDirection = GeoOperations.bearingToHuman(bearing)
|
||||
return { distance, bearing, distanceInMeters, bearingDirection }
|
||||
},
|
||||
[currentLocation]
|
||||
)
|
||||
let hasCompass = Orientation.singleton.gotMeasurement
|
||||
let compass = Orientation.singleton.alpha
|
||||
let relativeBearing: Store<{distance: string, bearing: Translation}> =
|
||||
compass.mapD(compass => {
|
||||
const bearing: Translation = relativeDir[GeoOperations.bearingToHumanRelative(distanceToCurrentLocation.data.bearing - compass)]
|
||||
return {bearing, distance: distanceToCurrentLocation.data.distance}
|
||||
}, [distanceToCurrentLocation])
|
||||
let viewportCenterDetails = Translations.DynamicSubstitute(t.viewportCenterDetails, relativeBearing)
|
||||
let viewportCenterDetailsAbsolute = Translations.DynamicSubstitute(t.viewportCenterDetails, distanceToCurrentLocation.mapD(({distance, bearing}) => {
|
||||
return {distance, bearing: t.directionsAbsolute[GeoOperations.bearingToHuman(bearing)]}
|
||||
}))
|
||||
|
||||
let relativeBearing: Store<{ distance: string; bearing: Translation }> = compass.mapD(
|
||||
(compass) => {
|
||||
const bearing: Translation =
|
||||
relativeDir[
|
||||
GeoOperations.bearingToHumanRelative(distanceToCurrentLocation.data.bearing - compass)
|
||||
]
|
||||
return { bearing, distance: distanceToCurrentLocation.data.distance }
|
||||
},
|
||||
[distanceToCurrentLocation]
|
||||
)
|
||||
let viewportCenterDetails = Translations.DynamicSubstitute(
|
||||
t.viewportCenterDetails,
|
||||
relativeBearing
|
||||
)
|
||||
let viewportCenterDetailsAbsolute = Translations.DynamicSubstitute(
|
||||
t.viewportCenterDetails,
|
||||
distanceToCurrentLocation.mapD(({ distance, bearing }) => {
|
||||
return { distance, bearing: t.directionsAbsolute[GeoOperations.bearingToHuman(bearing)] }
|
||||
})
|
||||
)
|
||||
</script>
|
||||
|
||||
{#if $currentLocation !== undefined}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,7 @@
|
|||
() => {
|
||||
displayLocation()
|
||||
},
|
||||
[
|
||||
Translations.t.hotkeyDocumentation.shakePhone
|
||||
]
|
||||
[Translations.t.hotkeyDocumentation.shakePhone]
|
||||
)
|
||||
|
||||
Motion.singleton.startListening()
|
||||
|
|
@ -56,9 +54,9 @@
|
|||
{#if currentLocation}
|
||||
<div
|
||||
aria-live="assertive"
|
||||
class="normal-background border-interactive rounded-full px-2 flex flex-col items-center"
|
||||
class="normal-background border-interactive flex flex-col items-center rounded-full px-2"
|
||||
>
|
||||
{currentLocation}.
|
||||
<MapCenterDetails {state}/>
|
||||
<MapCenterDetails {state} />
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@
|
|||
<!-- Title element-->
|
||||
<h3>
|
||||
<a href={`#${$tags.id}`}>
|
||||
<TagRenderingAnswer config={layer.title} {selectedElement} {state} {tags} {layer} />
|
||||
<TagRenderingAnswer config={layer.title} {selectedElement} {state} {tags} {layer} />
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
|
||||
<div
|
||||
class="no-weblate title-icons links-as-button mr-2 flex flex-row flex-wrap items-center gap-x-0.5 p-1 pt-0.5 sm:pt-1"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -12,17 +12,24 @@
|
|||
let id = feature.properties.id
|
||||
let tags = state.featureProperties.getStore(id)
|
||||
let layer: LayerConfig = state.layout.getMatchingLayer(tags.data)
|
||||
|
||||
</script>
|
||||
|
||||
<span class="inline-flex gap-x-1">
|
||||
|
||||
<a class="small flex space-x-0.5 cursor-pointer w-fit items-center" href={`#${feature.properties.id}`}>
|
||||
{#if i !== undefined}
|
||||
<span class="font-bold">{i + 1} </span>
|
||||
{/if}
|
||||
<TagRenderingAnswer config={layer.title} extraClasses="inline-flex w-fit" {layer} selectedElement={feature} {state}
|
||||
{tags} />
|
||||
</a>
|
||||
<a
|
||||
class="small flex w-fit cursor-pointer items-center space-x-0.5"
|
||||
href={`#${feature.properties.id}`}
|
||||
>
|
||||
{#if i !== undefined}
|
||||
<span class="font-bold">{i + 1} </span>
|
||||
{/if}
|
||||
<TagRenderingAnswer
|
||||
config={layer.title}
|
||||
extraClasses="inline-flex w-fit"
|
||||
{layer}
|
||||
selectedElement={feature}
|
||||
{state}
|
||||
{tags}
|
||||
/>
|
||||
</a>
|
||||
<DirectionIndicator {feature} {state} />
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -15,16 +15,17 @@
|
|||
const t = Translations.t.general.visualFeedback
|
||||
let map = state.mapProperties
|
||||
let centerFeatures = state.closestFeatures.features
|
||||
let translationWithLength = centerFeatures.mapD(cf => cf.length).mapD(n => {
|
||||
if (n === 1) {
|
||||
return t.oneFeatureInView
|
||||
}
|
||||
return t.closestFeaturesAre.Subs({ n })
|
||||
})
|
||||
|
||||
let translationWithLength = centerFeatures
|
||||
.mapD((cf) => cf.length)
|
||||
.mapD((n) => {
|
||||
if (n === 1) {
|
||||
return t.oneFeatureInView
|
||||
}
|
||||
return t.closestFeaturesAre.Subs({ n })
|
||||
})
|
||||
|
||||
let lastAction: UIEventSource<KeyNavigationEvent> = new UIEventSource<KeyNavigationEvent>(
|
||||
undefined,
|
||||
undefined
|
||||
)
|
||||
state.mapProperties.onKeyNavigationEvent((event) => {
|
||||
lastAction.setData(event)
|
||||
|
|
@ -32,11 +33,11 @@
|
|||
lastAction.stabilized(750).addCallbackAndRunD((_) => lastAction.setData(undefined))
|
||||
</script>
|
||||
|
||||
<div aria-live="assertive" class="p-1 bg-white m-1 rounded">
|
||||
<div aria-live="assertive" class="m-1 rounded bg-white p-1">
|
||||
{#if $lastAction?.key === "out"}
|
||||
<Tr t={t.out.Subs({z: map.zoom.data - 1})} />
|
||||
<Tr t={t.out.Subs({ z: map.zoom.data - 1 })} />
|
||||
{:else if $lastAction?.key === "in"}
|
||||
<Tr t={t.out.Subs({z: map.zoom.data + 1})} />
|
||||
<Tr t={t.out.Subs({ z: map.zoom.data + 1 })} />
|
||||
{:else if $lastAction !== undefined}
|
||||
<Tr t={t[$lastAction.key]} />
|
||||
{:else if $centerFeatures?.length === 0}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue