Map: явный синий маркер 'Я' + invalidateSize + zoom 14
This commit is contained in:
parent
4706203de8
commit
000206426f
@ -159,14 +159,34 @@ const MapView = {
|
||||
console.warn('updateLocation:', e);
|
||||
}
|
||||
if (this.map) {
|
||||
this.map.setView([lat, lng], 13);
|
||||
// важно: invalidateSize() чтобы Leaflet пересчитал размеры (после смены таба лейаут мог обнулиться)
|
||||
this.map.invalidateSize();
|
||||
// убираем старый self-marker и круг
|
||||
if (this.selfMarker) { this.map.removeLayer(this.selfMarker); this.selfMarker = null; }
|
||||
this.map.eachLayer((layer) => {
|
||||
if (layer instanceof L.Circle) this.map.removeLayer(layer);
|
||||
if (layer instanceof L.Circle && layer.options && layer.options._isRadius) {
|
||||
this.map.removeLayer(layer);
|
||||
}
|
||||
});
|
||||
// маркер "Я"
|
||||
const meIcon = L.divIcon({
|
||||
className: 'self-marker',
|
||||
html: '<div style="width:18px;height:18px;border-radius:50%;background:#4285F4;border:3px solid white;box-shadow:0 0 0 2px rgba(66,133,244,0.4);"></div>',
|
||||
iconSize: [18, 18],
|
||||
iconAnchor: [9, 9],
|
||||
});
|
||||
this.selfMarker = L.marker([lat, lng], { icon: meIcon, zIndexOffset: 1000 }).addTo(this.map);
|
||||
// круг радиуса
|
||||
L.circle([lat, lng], {
|
||||
radius: this.radius * 1000,
|
||||
color: '#FF6B35', fillColor: '#FF6B35', fillOpacity: 0.1, weight: 2,
|
||||
color: '#FF6B35',
|
||||
fillColor: '#FF6B35',
|
||||
fillOpacity: 0.1,
|
||||
weight: 2,
|
||||
_isRadius: true,
|
||||
}).addTo(this.map);
|
||||
// центр + zoom на мне
|
||||
this.map.setView([lat, lng], 14, { animate: true });
|
||||
this.refreshNearbyFromPos(lat, lng);
|
||||
this.refreshPlacesFromPos(lat, lng);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user