Skip to content

Commit e9cd12b

Browse files
committed
refactor(map): change coordinate creation
1 parent 09b1e64 commit e9cd12b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: lib/util/itinerary.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,15 @@ export function getItineraryBounds (itinerary) {
232232
* Return a leaflet LatLngBounds object that encloses the given leg's geometry.
233233
*/
234234
export function getLegBounds (leg) {
235-
let coords = polyline
235+
const coords = polyline
236236
.toGeoJSON(leg.legGeometry.points)
237237
.coordinates.map(c => [c[1], c[0]])
238238

239239
// in certain cases, there might be zero-length coordinates in the leg
240240
// geometry. In these cases, build us an array of coordinates using the from
241241
// and to data of the leg.
242242
if (coords.length === 0) {
243-
coords = [
244-
[leg.from.lat, leg.from.lon],
245-
[leg.to.lat, leg.to.lon]
246-
]
243+
coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon])
247244
}
248245
return latLngBounds(coords)
249246
}

0 commit comments

Comments
 (0)