Просмотр исходного кода

fix: add 'location' to MarkerOptions type union

neyrogovnarik 1 месяц назад
Родитель
Сommit
e702fc1bb7
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      frontend/src/lib/map.ts

+ 4 - 3
frontend/src/lib/map.ts

@@ -11,7 +11,7 @@ export interface MapBounds {
 }
 
 export interface MarkerOptions {
-  type?: 'place' | 'studio' | 'visitor'
+  type?: 'place' | 'studio' | 'visitor' | 'location'
   title?: string
   onClick?: () => void
   ghost?: boolean
@@ -115,9 +115,10 @@ export function createLeafletMapProvider(): MapProvider {
       if (!map) return
       const ghost = options?.ghost
       const type = options?.type || 'place'
-      const size = type === 'visitor' ? 12 : 32
+      const size = type === 'visitor' || type === 'location' ? 12 : 32
       const icon = createIcon(type, size, ghost)
-      const marker = L.marker([lat, lng], { icon, interactive: !ghost }).addTo(map)
+      const interactive = !ghost && type !== 'location'
+      const marker = L.marker([lat, lng], { icon, interactive }).addTo(map)
 
       if (options?.title && !ghost) {
         marker.bindTooltip(options.title, { direction: 'top' })