feat(rover): drop highlight marker on selected candidate

This commit is contained in:
Graham McIntire 2026-04-25 17:15:53 -05:00
parent 5631444abd
commit a9a3d22ae6
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -24,6 +24,7 @@ interface RoverMapHook extends ViewHook {
homeMarker: L.CircleMarker | null
driveCircle: L.Circle | null
qualityLayer: L.GridLayer | null
selectedCandidateMarker: L.CircleMarker | null
cellLookup: Map<string, Cell>
homeLat: number
homeLon: number
@ -82,6 +83,7 @@ export const RoverMap: Partial<RoverMapHook> = {
this.homeMarker = null
this.driveCircle = null
this.qualityLayer = null
this.selectedCandidateMarker = null
this.cellLookup = new Map()
this.topoLayer = null
@ -210,6 +212,20 @@ export const RoverMap: Partial<RoverMapHook> = {
this.handleEvent("focus_cell", (
{ lat, lon, zoom }: { lat: number; lon: number; zoom: number }
) => {
// Drop a single highlight marker at the picked spot, replacing
// any previous one — clicking another candidate moves it.
if (this.selectedCandidateMarker) {
this.map.removeLayer(this.selectedCandidateMarker)
}
this.selectedCandidateMarker = L.circleMarker([lat, lon], {
radius: 8,
color: "#0ea5e9",
weight: 2,
fillColor: "#0ea5e9",
fillOpacity: 0.6,
pane: "markerPane"
}).addTo(this.map)
this.map.flyTo([lat, lon], zoom, { duration: 0.6 })
})
},