Fix InfoPanel map: hide toggle, show current entity, auto-center
All checks were successful
Build Docker Image / build (push) Successful in 4m18s

- 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
This commit is contained in:
Ruslan Bakiev
2026-01-27 11:25:57 +07:00
parent 80474acc0f
commit ff34c564e1
3 changed files with 53 additions and 21 deletions

View File

@@ -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

View File

@@ -64,8 +64,8 @@
</label>
<!-- View toggle (top RIGHT overlay, below header) -->
<div class="absolute top-[116px] right-4 z-20 hidden lg:flex items-center gap-2">
<!-- View toggle (top RIGHT overlay, below header) - hide in info mode -->
<div v-if="!isInfoMode" class="absolute top-[116px] right-4 z-20 hidden lg:flex items-center gap-2">
<!-- View mode toggle -->
<div class="flex gap-1 bg-black/30 backdrop-blur-md rounded-lg p-1 border border-white/10">
<button
@@ -126,8 +126,8 @@
<span>{{ $t('catalog.list') }}</span>
</button>
<!-- Mobile view toggle -->
<div class="flex gap-1 bg-black/30 backdrop-blur-md rounded-lg p-1 border border-white/10">
<!-- Mobile view toggle - hide in info mode -->
<div v-if="!isInfoMode" class="flex gap-1 bg-black/30 backdrop-blur-md rounded-lg p-1 border border-white/10">
<button
class="flex items-center justify-center w-8 h-8 rounded-md transition-colors"
:class="mapViewMode === 'offers' ? 'bg-white/20' : 'hover:bg-white/10'"