Skip to content

Commit

Permalink
Merge pull request mapbox#2 from patrix/instructions-all-legs
Browse files Browse the repository at this point in the history
Instructions for all legs
  • Loading branch information
patrix committed Nov 21, 2018
2 parents 51fb4b0 + 9d372ad commit b365b3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controls/instructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Instructions {

if (directions.length && shouldRender) {
const direction = this.directions = directions[routeIndex];
const allSteps = direction.legs.reduce((legs, leg) => legs.concat(leg.steps), []);

if (compile) {
direction.legs.forEach(function(leg) {
Expand All @@ -50,7 +51,7 @@ export default class Instructions {
this.container.innerHTML = instructionsTemplate({
routeIndex,
routes: directions.length,
steps: direction.legs[0].steps, // Todo: Respect all legs,
steps: allSteps,
format: utils.format[unit],
duration: utils.format[unit](direction.distance),
distance: utils.format.duration(direction.duration)
Expand Down

0 comments on commit b365b3e

Please sign in to comment.