From 8ca602575c8404313413fe5c4a8f4f3854d8f971 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Wed, 2 Dec 2020 21:11:57 +0100 Subject: [PATCH] Do not override nogos on url load (#349) --- js/index.js | 9 ++++----- js/plugin/CircleGoArea.js | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/js/index.js b/js/index.js index 2c75973..722d2f0 100644 --- a/js/index.js +++ b/js/index.js @@ -394,11 +394,6 @@ var opts = router.parseUrlParams(url2params(url)); router.setOptions(opts); routingOptions.setOptions(opts); - if (circlego && opts.circlego) { - // must be done before nogos! - circlego.options.radius = opts.circlego[2]; - circlego.setCircle([opts.circlego[0], opts.circlego[1]]); - } nogos.setOptions(opts); profile.update(opts); @@ -410,6 +405,10 @@ if (opts.pois) { pois.setMarkers(opts.pois); } + if (circlego && opts.circlego) { + circlego.options.radius = opts.circlego[2]; + circlego.setCircle([opts.circlego[0], opts.circlego[1]], opts.polylines != null); + } }; var onInvalidHashChangeCb = function(params) { diff --git a/js/plugin/CircleGoArea.js b/js/plugin/CircleGoArea.js index d44276d..fe0c07f 100644 --- a/js/plugin/CircleGoArea.js +++ b/js/plugin/CircleGoArea.js @@ -96,10 +96,10 @@ BR.CircleGoArea = L.Control.extend({ }, onMapClick: function(e) { - this.setCircle([e.latlng.lng, e.latlng.lat]); + this.setCircle([e.latlng.lng, e.latlng.lat], false); }, - setCircle: function(center) { + setCircle: function(center, skipNogo) { var self = this; var icon = L.VectorMarkers.icon({ icon: 'home', @@ -119,7 +119,7 @@ BR.CircleGoArea = L.Control.extend({ this.clear(); marker.addTo(this.circleLayer); - this.setNogoCircle(center); + if (!skipNogo) this.setNogoCircle(center); this.draw(false); },