diff --git a/resources/views/menu_v1/reports/_trip_detail.blade.php b/resources/views/menu_v1/reports/_trip_detail.blade.php index 0937da2..d2cb66d 100644 --- a/resources/views/menu_v1/reports/_trip_detail.blade.php +++ b/resources/views/menu_v1/reports/_trip_detail.blade.php @@ -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]))); });