From 0947bbc89cb216e937f1578455fc2a2dba6eeb49 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 7 Apr 2017 08:42:52 +0200 Subject: [PATCH] Support URL even if latlon are missing --- js/index.js | 6 +----- js/router/BRouter.js | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/js/index.js b/js/index.js index 8041867..f743695 100644 --- a/js/index.js +++ b/js/index.js @@ -236,11 +236,7 @@ profile.update(routingOptions.getOptions()); urlHash = new L.Hash(map, mapLayers, function() { - var latLngs = routing.getWaypoints(); - if (latLngs.length > 1) { - return router.getUrl(latLngs, null); - } - return null; + return router.getUrl(routing.getWaypoints(), null); }); routingOptions.on('update', urlHash.updateHash, urlHash); nogos.on('update', urlHash.updateHash, urlHash); diff --git a/js/router/BRouter.js b/js/router/BRouter.js index 6e44699..78af931 100644 --- a/js/router/BRouter.js +++ b/js/router/BRouter.js @@ -79,7 +79,7 @@ L.BRouter = L.Class.extend({ var urlParams = this.getUrlParams(latLngs, format); var args = [] - if (urlParams.lonlats != null) + if (urlParams.lonlats != null && urlParams.lonlats.length > 0) args.push(L.Util.template('lonlats={lonlats}', urlParams)); if (urlParams.nogos != null) args.push(L.Util.template('nogos={nogos}', urlParams));