Skip to content

Commit

Permalink
mission-planning: Add home marker to the planning view
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed May 16, 2023
1 parent 118dcc1 commit a24cb97
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/views/MissionPlanningView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,30 @@ watch(vehicleStore.coordinates, () => {
vehicleMarker.value.setLatLng(position as LatLngTuple)
})
const homeMarker = ref<L.Marker>()
watch(home, () => {
if (planningMap.value === undefined) throw new Error('Map not yet defined')
const position = home.value
if (position === undefined) return
if (homeMarker.value === undefined) {
homeMarker.value = L.marker(position as LatLngTuple)
var homeMarkerIcon = L.divIcon({ className: 'marker-icon', iconSize: [16, 16], iconAnchor: [8, 8] })
homeMarker.value.setIcon(homeMarkerIcon)
const homeMarkerTooltip = L.tooltip({
content: 'H',
permanent: true,
direction: 'center',
className: 'waypoint-tooltip',
opacity: 1,
})
homeMarker.value.bindTooltip(homeMarkerTooltip)
planningMap.value.addLayer(homeMarker.value)
}
homeMarker.value.setLatLng(home.value)
})
watch(planningMap, (newMap, oldMap) => {
if (planningMap.value !== undefined && newMap?.options === undefined) {
planningMap.value = oldMap
Expand Down

0 comments on commit a24cb97

Please sign in to comment.