diff --git a/src/components/common/MapView.vue b/src/components/common/MapView.vue index ec094548..94586ddc 100644 --- a/src/components/common/MapView.vue +++ b/src/components/common/MapView.vue @@ -13,7 +13,8 @@ import { ref, computed, useTemplateRef } from 'vue'; import { useI18n } from '@/locales/helpers.ts'; -import type { MapInstance, MapPosition } from '@/lib/map/base.ts'; +import type { MapPosition } from '@/core/map.ts'; +import type { MapInstance } from '@/lib/map/base.ts'; import { createMapInstance } from '@/lib/map/index.ts'; const props = defineProps<{ @@ -23,6 +24,10 @@ const props = defineProps<{ geoLocation?: MapPosition; }>(); +const emit = defineEmits<{ + (e: 'click', geoLocation: MapPosition): void; +}>(); + const { tt, getCurrentLanguageInfo } = useI18n(); const mapContainer = useTemplateRef('mapContainer'); @@ -86,6 +91,9 @@ function initMapView(): void { text: { zoomIn: tt('Zoom in'), zoomOut: tt('Zoom out'), + }, + onClick: (geoLocation: MapPosition) => { + emit('click', geoLocation); } }); @@ -105,7 +113,18 @@ function initMapView(): void { } } +function setMarkerPosition(geoLocation?: MapPosition): void { + if (!mapInstance.value) { + return; + } + + if (geoLocation) { + mapInstance.value.setMapCenterMarker(geoLocation); + } +} + defineExpose({ - initMapView + initMapView, + setMarkerPosition }); diff --git a/src/components/mobile/MapSheet.vue b/src/components/mobile/MapSheet.vue index b9dc6f3c..4f270576 100644 --- a/src/components/mobile/MapSheet.vue +++ b/src/components/mobile/MapSheet.vue @@ -3,13 +3,16 @@ :opened="show" @sheet:open="onSheetOpen" @sheet:closed="onSheetClosed">
-
+
+ + +
- +