File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ class BaseMap extends Component {
275275 center = { center }
276276 // onClick={this._onLeftClick}
277277 zoom = { config . map . initZoom || 13 }
278+ maxZoom = { config . map . maxZoom }
278279 onOverlayAdd = { this . _onOverlayAdd }
279280 onOverlayRemove = { this . _onOverlayRemove }
280281 onViewportChanged = { this . _onViewportChanged }
Original file line number Diff line number Diff line change @@ -228,11 +228,24 @@ export function getItineraryBounds (itinerary) {
228228 return latLngBounds ( coords )
229229}
230230
231+ /**
232+ * Return a leaflet LatLngBounds object that encloses the given leg's geometry.
233+ */
231234export function getLegBounds ( leg ) {
232- return latLngBounds ( polyline
235+ let coords = polyline
233236 . toGeoJSON ( leg . legGeometry . points )
234237 . coordinates . map ( c => [ c [ 1 ] , c [ 0 ] ] )
235- )
238+
239+ // in certain cases, there might be zero-length coordinates in the leg
240+ // geometry. In these cases, build us an array of coordinates using the from
241+ // and to data of the leg.
242+ if ( coords . length === 0 ) {
243+ coords = [
244+ [ leg . from . lat , leg . from . lon ] ,
245+ [ leg . to . lat , leg . to . lon ]
246+ ]
247+ }
248+ return latLngBounds ( coords )
236249}
237250
238251export function routeComparator ( a , b ) {
You can’t perform that action at this time.
0 commit comments