Skip to content

Commit

Permalink
Merge pull request #112 from opentripplanner/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
landonreed authored Sep 19, 2019
2 parents 1e6c365 + 6497ce9 commit 30b71a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/components/map/base-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class BaseMap extends Component {
center={center}
// onClick={this._onLeftClick}
zoom={config.map.initZoom || 13}
maxZoom={config.map.maxZoom}
onOverlayAdd={this._onOverlayAdd}
onOverlayRemove={this._onOverlayRemove}
onViewportChanged={this._onViewportChanged}
Expand Down
14 changes: 12 additions & 2 deletions lib/util/itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,21 @@ export function getItineraryBounds (itinerary) {
return latLngBounds(coords)
}

/**
* Return a leaflet LatLngBounds object that encloses the given leg's geometry.
*/
export function getLegBounds (leg) {
return latLngBounds(polyline
const coords = polyline
.toGeoJSON(leg.legGeometry.points)
.coordinates.map(c => [c[1], c[0]])
)

// in certain cases, there might be zero-length coordinates in the leg
// geometry. In these cases, build us an array of coordinates using the from
// and to data of the leg.
if (coords.length === 0) {
coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon])
}
return latLngBounds(coords)
}

export function routeComparator (a, b) {
Expand Down

0 comments on commit 30b71a3

Please sign in to comment.