From ff34c564e1ee48ec028fab20c34e3de22ca41c1d Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:25:57 +0700 Subject: [PATCH] Fix InfoPanel map: hide toggle, show current entity, auto-center - Hide view mode toggle (offers/hubs/suppliers) when in InfoPanel mode - Add current entity to relatedPoints so it's visible on the map - Auto-fit map bounds to show all points (current + related) in InfoPanel mode --- app/components/catalog/CatalogMap.vue | 17 ++++++++-- app/components/page/CatalogPage.vue | 8 ++--- app/pages/catalog/index.vue | 49 +++++++++++++++++++-------- 3 files changed, 53 insertions(+), 21 deletions(-) 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 @@ - -