add logoutput for user and community locations on initMap

This commit is contained in:
clauspeterhuebner 2024-11-26 03:01:42 +01:00
parent 3758c742e5
commit 7f452fd94a

View File

@ -36,12 +36,15 @@ const props = defineProps({
const { t } = useI18n()
onMounted(async () => {
console.log('onMounted() props=', props)
if (props.userMarkerCoords) {
userPosition.value = props.userMarkerCoords
}
if (props.communityMarkerCoords) {
communityPosition.value = props.communityMarkerCoords
}
console.log('onMounted() userPosition=', userPosition)
console.log('onMounted() communityPosition=', communityPosition)
await nextTick()
initMap()
window.addEventListener('resize', handleResize)
@ -55,12 +58,14 @@ onUnmounted(() => {
})
function initMap() {
console.log('initMap()...')
if (mapContainer.value && !map.value) {
map.value = L.map(mapContainer.value, {
center: [userPosition.value.lat, userPosition.value.lng],
zoom: defaultZoom,
zoomControl: false,
})
console.log('initMap() map=', map)
L.control.zoom({ position: 'topleft' }).addTo(map.value)
@ -82,6 +87,7 @@ function initMap() {
shadowSize: [41, 41],
}),
}).addTo(map.value)
console.log('initMap() userMarker=', userMarker)
userMarker.value.bindPopup(t('settings.GMS.map.userLocationLabel')).openPopup()
@ -98,6 +104,7 @@ function initMap() {
shadowSize: [41, 41],
}),
}).addTo(map.value)
console.log('initMap() communityMarker=', communityMarker)
communityMarker.value.bindPopup(t('settings.GMS.map.communityLocationLabel'))