Merge branch 'master' of https://gitlab.com/m3f_usm/admin_transporte/frontend into develop/Ronald

develop/Ronald
Ronald Morales 2024-03-06 15:35:57 -03:00
commit fac33c2d8a
1 changed files with 12 additions and 3 deletions

View File

@ -85,8 +85,12 @@
}
if (!myMap) {
myMap = L.map(elMap)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{ attribution: '&copy; <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }
L.tileLayer(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution: '&copy; <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
).addTo(myMap);
}
@ -114,7 +118,11 @@
const coordenadas = data.positions.map(({ shape_pt_lat, shape_pt_lon}) => [shape_pt_lat, shape_pt_lon])
polyline = L.polyline(coordenadas, { color: 'red' }).addTo(myMap)
myMap.fitBounds(polyline.getBounds());
const bound = polyline.getBounds()
if (bound._northEast && bound._southWset) {
myMap.fitBounds(polyline.getBounds());
}
if (coordenadas) {
marker1 = L.marker(coordenadas[0], { icon: iconPartida }).addTo(myMap)
@ -124,6 +132,7 @@
}
} catch (error) {
console.log({ error })
globalThis.toast.error(error)
} finally {
loading = false;