feat(rover): drop highlight marker on selected candidate
This commit is contained in:
parent
5631444abd
commit
a9a3d22ae6
1 changed files with 16 additions and 0 deletions
|
|
@ -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 })
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue