Sửa lỗi khi click vào nút bản đồ
This commit is contained in:
@@ -160,7 +160,8 @@ export const ItineraryTimeline = ({ onAddLocation }: { onAddLocation?: (legId: s
|
||||
|
||||
<div className="ml-2">
|
||||
{leg.locations.map((location, idx) => {
|
||||
const nextLocation = leg.locations[idx + 1];
|
||||
// Logic quan trọng: Gán điểm cuối chặng này nối với điểm đầu chặng sau
|
||||
const nextLocation = leg.locations[idx + 1] || legs[legIdx + 1]?.locations[0];
|
||||
const distanceToNext = nextLocation
|
||||
? calculateDistance(location.latitude, location.longitude, nextLocation.latitude, nextLocation.longitude)
|
||||
: null;
|
||||
|
||||
Reference in New Issue
Block a user