diff --git a/app/components/catalog/CatalogMap.vue b/app/components/catalog/CatalogMap.vue index f98a1d0..0ebf406 100644 --- a/app/components/catalog/CatalogMap.vue +++ b/app/components/catalog/CatalogMap.vue @@ -693,13 +693,26 @@ watch(() => props.hoveredItem, () => { } }, { deep: true }) -// Update related points layer when relatedPoints changes -watch(() => props.relatedPoints, () => { +// Update related points layer when relatedPoints changes + fit bounds +watch(() => props.relatedPoints, (points) => { if (!mapRef.value || !mapInitialized.value) return + + // Update the source data const source = mapRef.value.getSource(relatedSourceId.value) as mapboxgl.GeoJSONSource | undefined if (source) { source.setData(relatedPointsGeoJson.value) } + + // Fit bounds to show all related points (Info mode) + if (points && points.length > 0) { + const bounds = new LngLatBounds() + points.forEach(p => { + bounds.extend([p.longitude, p.latitude]) + }) + if (!bounds.isEmpty()) { + mapRef.value.fitBounds(bounds, { padding: 80, maxZoom: 12 }) + } + } }, { deep: true }) // Watch for pointColor or entityType changes - update colors and icons diff --git a/app/components/page/CatalogPage.vue b/app/components/page/CatalogPage.vue index b6dc557..9e1b013 100644 --- a/app/components/page/CatalogPage.vue +++ b/app/components/page/CatalogPage.vue @@ -64,8 +64,8 @@ - -