Read time/energy calc variables from profile

and ensure profile text is loaded before updating route and straight line stats
This commit is contained in:
Norbert Renner 2022-02-15 19:30:49 +01:00
parent 9abf4b94c4
commit 4d44153316
5 changed files with 57 additions and 20 deletions

View file

@ -39,6 +39,12 @@ BR.Routing = L.Routing.extend({
},
},
initialize: function (profile, options) {
L.Routing.prototype.initialize.call(this, options);
this.profile = profile;
},
onAdd: function (map) {
this.options.tooltips.waypoint = i18next.t('map.route-tooltip-waypoint');
this.options.tooltips.segment = i18next.t('map.route-tooltip-segment');
@ -484,7 +490,7 @@ BR.Routing = L.Routing.extend({
},
_computeKinematic: function (distance, deltaHeight) {
const rc = new BR.RoutingContext();
const rc = new BR.RoutingContext(this.profile);
const stdPath = new BR.StdPath();
stdPath.computeKinematic(rc, distance, deltaHeight, true);