diff --git a/src/components/Map/MapView.jsx b/src/components/Map/MapView.jsx index ac45aed..55fda91 100644 --- a/src/components/Map/MapView.jsx +++ b/src/components/Map/MapView.jsx @@ -245,6 +245,12 @@ export default function MapView({ const handleSearch = (query) => { console.log('[MapView] Search/filter by:', query); setSearchQuery(query); + + // Clear category filters to show all search results + if (query.trim()) { + setMainFilter("All"); + setSubFilter("All"); + } }; // Zoom intelligent: quand on cherche, zoom pour voir tous les résultats diff --git a/src/components/Map/markerManager.js b/src/components/Map/markerManager.js index 8931858..3b4855c 100644 --- a/src/components/Map/markerManager.js +++ b/src/components/Map/markerManager.js @@ -314,6 +314,15 @@ function calculateSmartOffset(post, markersRef, map) { const lon = typeof post.lon === "number" ? post.lon : typeof post.lng === "number" ? post.lng : null; if (lat == null || lon == null) return { x: 0, y: 0 }; + // Si le post est très récent (< 10 secondes), pas d'offset - respect de la position crosshair + const createdAt = post?.created_at || post?.CreatedAt || post?.createdAt; + if (createdAt) { + const ageSeconds = (Date.now() - new Date(createdAt).getTime()) / 1000; + if (ageSeconds < 10) { + return { x: 0, y: 0 }; + } + } + const currentPoint = map.project([lon, lat]); const PROXIMITY_THRESHOLD = 100; // pixels - larger to detect more overlaps