fix(gps): zIndex точек трека над полилиниями + capture-клики; offroad-фильтр LBS при выдаче трека (чистит старый «мяч»)

This commit is contained in:
2026-08-29 21:36:55 +03:00
parent a302f0c0ea
commit 3ff74d0d17
6 changed files with 72 additions and 11 deletions

View File

@@ -108,7 +108,7 @@ export function OsmMap({
marker.onClick();
map.closePopup();
}
});
}, true); // capture: leaflet глушит bubble
mapRef.current = map;

View File

@@ -166,8 +166,8 @@ export function Yandex21Map({
mapRef.current?.balloon.close();
}
};
container.addEventListener('click', handler);
return () => container.removeEventListener('click', handler);
container.addEventListener('click', handler, true); // capture: ymaps/leaflet глушат bubble
return () => container.removeEventListener('click', handler, true);
}, [mapReady]);
// Перемещение viewport только при реальном изменении center/zoom/bounds,

View File

@@ -375,14 +375,14 @@ export function GpsRoutesTab() {
course: p.course ?? undefined,
onClick: () => seekToPoint(p),
noCluster: true,
zIndex: 2,
zIndex: 100, // над полилиниями (matched/сегменты), иначе клики перехватывает линия
})),
...(first ? [{ id: 'start', lat: first.lat, lng: first.lng, kind: 'dot' as const, color: '#22c55e', label: 'Старт', zIndex: 5, noCluster: true }] : []),
...(first ? [{ id: 'start', lat: first.lat, lng: first.lng, kind: 'dot' as const, color: '#22c55e', label: 'Старт', zIndex: 110, noCluster: true }] : []),
...(last && activePoints.length > 1
? [{ id: 'finish', lat: last.lat, lng: last.lng, kind: 'dot' as const, color: '#ef4444', label: 'Финиш', zIndex: 5, noCluster: true }]
? [{ id: 'finish', lat: last.lat, lng: last.lng, kind: 'dot' as const, color: '#ef4444', label: 'Финиш', zIndex: 110, noCluster: true }]
: []),
...(playPoint
? [{ id: 'playhead', lat: playPoint.lat, lng: playPoint.lng, kind: 'dot' as const, color: selectedAsset?.color || '#3b82f6', zIndex: 20, noCluster: true }]
? [{ id: 'playhead', lat: playPoint.lat, lng: playPoint.lng, kind: 'dot' as const, color: selectedAsset?.color || '#3b82f6', zIndex: 120, noCluster: true }]
: []),
];
@@ -523,6 +523,11 @@ export function GpsRoutesTab() {
{!activeTrip && trackData?.sampled && ` (всего ${trackData.total}, показана каждая N-я)`}
{pointsThinned && `, маркеров на карте: ${displayedPoints.length}`}
</span>
{(trackData?.offroadFiltered ?? 0) > 0 && (
<span>
Отсеяно LBS-мусора: <span className="text-foreground font-medium">{trackData!.offroadFiltered}</span>
</span>
)}
{(trackData?.filteredCount ?? 0) > 0 && (
<span>
Отфильтровано мусорных точек:{' '}

View File

@@ -78,6 +78,8 @@ export interface GpsTrackResponse {
total: number;
/** Число отброшенных сервером устаревших/телепорт-точек */
filteredCount?: number;
/** Отсеяно LBS-мусорных точек (далеко от дороги) при выдаче */
offroadFiltered?: number;
sampled: boolean;
/** Линия трека по дорогам от OSRM (при ?matched=1); null — OSRM недоступен */
matched?: { points: Array<[number, number]>; distance: number; duration: number } | null;