fitBounds
This commit is contained in:
@ -108,10 +108,11 @@
|
||||
$(this).text(moment.unix(unix).format('DD MMM YYYY HH:mm:ss'));
|
||||
});
|
||||
|
||||
|
||||
let coords
|
||||
setTimeout(() => {
|
||||
map.invalidateSize(); // force Leaflet to recalc
|
||||
// map.fitBounds(polyline.getBounds());
|
||||
map.fitBounds(coords.map(c => L.latLng(c[0], c[1])));
|
||||
}, 200);
|
||||
|
||||
const linesData = (@json($list));
|
||||
@ -231,7 +232,7 @@
|
||||
fetchOsrm(points).then(osrm => {
|
||||
if (!osrm) return console.log("OSRM gagal");
|
||||
|
||||
const coords = osrm.routes[0].legs.flatMap(leg =>
|
||||
coords = osrm.routes[0].legs.flatMap(leg =>
|
||||
leg.steps.flatMap(step =>
|
||||
decodeOSRMGeometry(step.geometry)
|
||||
)
|
||||
@ -242,7 +243,7 @@
|
||||
weight: 3,
|
||||
opacity: 0.8
|
||||
}).addTo(map);
|
||||
map.fitBounds(coords.map(c => L.latLng(c[0], c[1])));
|
||||
// map.fitBounds(coords.map(c => L.latLng(c[0], c[1])));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user