From 46b5c848e126718fe832548ef8fcb329642a8036 Mon Sep 17 00:00:00 2001 From: Per Liedman Date: Wed, 12 Aug 2015 22:21:36 +0200 Subject: [PATCH] Always enable instructions; fix typo. We do not have waypointIndices unless instructions are enabled. Close #6. --- src/L.Routing.GraphHopper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/L.Routing.GraphHopper.js b/src/L.Routing.GraphHopper.js index 9282d92..7ff3210 100644 --- a/src/L.Routing.GraphHopper.js +++ b/src/L.Routing.GraphHopper.js @@ -137,7 +137,10 @@ buildRouteUrl: function(waypoints, options) { var computeInstructions = - !(options && options.geometryOnly), + /* Instructions are always needed, + since we do not have waypoint indices otherwise */ + true, + //!(options && options.geometryOnly), locs = [], i, baseUrl; @@ -197,7 +200,7 @@ wpIndices.push(0); wps.push(new L.Routing.Waypoint(coordinates[0], waypoints[0].name)); - for (i = 0; i < instructions && instructions.length; i++) { + for (i = 0; instructions && i < instructions.length; i++) { if (instructions[i].sign === 5) { // VIA_REACHED idx = instructions[i].interval[0]; wpIndices.push(idx);