From 9da10a9b32f91b11fbeafac2d63b7b5d66a1e737 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 26 Aug 2025 03:11:31 +0200 Subject: [PATCH] Fix: fix showing splitpoint icons --- src/UI/BigComponents/WaySplitMap.svelte | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/UI/BigComponents/WaySplitMap.svelte b/src/UI/BigComponents/WaySplitMap.svelte index 5d0132d48..53980f3ef 100644 --- a/src/UI/BigComponents/WaySplitMap.svelte +++ b/src/UI/BigComponents/WaySplitMap.svelte @@ -26,6 +26,7 @@ import type { SpecialVisualizationState } from "../SpecialVisualization" import SmallZoomButtons from "../Map/SmallZoomButtons.svelte" import CompassWidget from "./CompassWidget.svelte" + import type { OsmTags } from "../../Models/OsmFeature" const splitpoint_style = new LayerConfig( split_point, @@ -62,14 +63,14 @@ let map: UIEventSource = new UIEventSource(undefined) let adaptor = new MapLibreAdaptor(map, mapProperties) - let wayGeojson: Feature = >osmWay.asGeoJson() + let wayGeojson: Feature = >osmWay.asGeoJson() adaptor.location.setData(GeoOperations.centerpointCoordinatesObj(wayGeojson)) adaptor.bounds.setData(BBox.get(wayGeojson).pad(2)) adaptor.maxbounds.setData(BBox.get(wayGeojson).pad(2)) state?.showCurrentLocationOn(map) new ShowDataLayer(map, { - features: new StaticFeatureSource([wayGeojson]), + features: new StaticFeatureSource>([wayGeojson]), drawMarkers: true, layer: layer, }) @@ -80,8 +81,8 @@ { id: string index: number - dist: number - location: number + dist?: number + location?: number } >[] > = new UIEventSource([]) @@ -97,7 +98,7 @@ return } splitPoints.data.splice(i, 1) - splitPoints.ping() + splitPoints.update(ls => [...ls]) }, }) let id = 0 @@ -105,8 +106,7 @@ let projected: Feature = ( GeoOperations.nearestPoint(wayGeojson, [lon, lat]) ) - - console.log("Added splitpoint", projected, id) + projected.properties.id = "" + id // We check the next and the previous point. If those are closer then the tolerance, we reuse those instead @@ -118,7 +118,6 @@ const previousPoint = <[number, number]>way[i] const previousDistance = GeoOperations.distanceBetween(previousPoint, p) - console.log("ND", nextDistance, "PD", previousDistance) if (nextDistance <= snapTolerance && previousDistance >= nextDistance) { projected = { type: "Feature", @@ -150,7 +149,7 @@ id++ splitPoints.data.push(projected) - splitPoints.ping() + splitPoints.update(ls => [...ls]) })