chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-11-28 12:00:23 +01:00
parent 8ef7af613f
commit 00151afdea
114 changed files with 2857 additions and 2135 deletions

View file

@ -28,7 +28,7 @@
(s) =>
(s === "yes" &&
state?.userRelatedState?.osmConnection?.userDetails?.data?.csCount >=
Constants.userJourney.tagsVisibleAt) ||
Constants.userJourney.tagsVisibleAt) ||
s === "always" ||
s === "full"
)
@ -64,9 +64,9 @@
<Tr t={filteredLayer.layerDef.name} />
{#if $zoomlevel < layer.minzoom}
<span class="alert">
<Tr t={Translations.t.general.layerSelection.zoomInToSeeThisLayer} />
</span>
<span class="alert">
<Tr t={Translations.t.general.layerSelection.zoomInToSeeThisLayer} />
</span>
{/if}
</Checkbox>
{/if}

View file

@ -65,22 +65,24 @@
export let onlyLink: boolean
const t = Translations.t.general.menu
let shown = new UIEventSource(state.guistate.pageStates.menu.data || !onlyLink)
state.guistate.pageStates.menu.addCallback(isShown => {
if(!onlyLink){
state.guistate.pageStates.menu.addCallback((isShown) => {
if (!onlyLink) {
return true
}
if(isShown){
if (isShown) {
shown.setData(true)
}else{
} else {
Utils.waitFor(250).then(() => {
shown.setData(state.guistate.pageStates.menu.data)
})
}
})
</script>
<div class="low-interaction flex h-screen flex-col gap-y-2 overflow-y-auto p-2 sm:gap-y-3 sm:p-3" class:hidden={!$shown}>
<div
class="low-interaction flex h-screen flex-col gap-y-2 overflow-y-auto p-2 sm:gap-y-3 sm:p-3"
class:hidden={!$shown}
>
<div class="flex justify-between">
<h2>
<Tr t={t.title} />

View file

@ -56,7 +56,7 @@
/**
* Reuse a point if the clicked location is within this amount of meter
*/
export let snapTolerance: number = 5
export let snapTolerance: number = 5
let map: UIEventSource<MlMap> = new UIEventSource<MlMap>(undefined)
let adaptor = new MapLibreAdaptor(map, mapProperties)
@ -101,7 +101,8 @@
})
let id = 0
adaptor.lastClickLocation.addCallbackD(({ lon, lat }) => {
let projected: Feature<Point, {index:number, id?: number, reuse?: string}> = GeoOperations.nearestPoint(wayGeojson, [lon, lat])
let projected: Feature<Point, { index: number; id?: number; reuse?: string }> =
GeoOperations.nearestPoint(wayGeojson, [lon, lat])
console.log("Added splitpoint", projected, id)
@ -110,36 +111,36 @@
const i = projected.properties.index
const p = projected.geometry.coordinates
const way = wayGeojson.geometry.coordinates
const nextPoint = <[number,number]> way[i + 1]
const nextPoint = <[number, number]>way[i + 1]
const nextDistance = GeoOperations.distanceBetween(nextPoint, p)
const previousPoint = <[number,number]> way[i]
const previousPoint = <[number, number]>way[i]
const previousDistance = GeoOperations.distanceBetween(previousPoint, p)
console.log("ND", nextDistance, "PD", previousDistance)
if(nextDistance <= snapTolerance && previousDistance >= nextDistance){
if (nextDistance <= snapTolerance && previousDistance >= nextDistance) {
projected = {
type:"Feature",
type: "Feature",
geometry: {
type:"Point",
coordinates: nextPoint
type: "Point",
coordinates: nextPoint,
},
properties: {
index: i+1,
reuse: "yes"
}
index: i + 1,
reuse: "yes",
},
}
}
if (previousDistance <= snapTolerance && previousDistance < nextDistance){
if (previousDistance <= snapTolerance && previousDistance < nextDistance) {
projected = {
type:"Feature",
type: "Feature",
geometry: {
type:"Point",
coordinates: previousPoint
type: "Point",
coordinates: previousPoint,
},
properties: {
index: i,
reuse: "yes"
}
reuse: "yes",
},
}
}