Fix broken route segment coloring (#250)
- with var instead of const all callbacks referenced last value in loop, add closure - cloning by property overwrites default when undefined, use L.extend for Object.assign
This commit is contained in:
parent
4676c3dcd0
commit
0809b17577
1 changed files with 7 additions and 10 deletions
|
|
@ -88,10 +88,12 @@ BR.RoutingPathQuality = L.Control.extend({
|
||||||
stateName: keys[i],
|
stateName: keys[i],
|
||||||
icon: provider.icon,
|
icon: provider.icon,
|
||||||
title: provider.title,
|
title: provider.title,
|
||||||
onClick: function(btn) {
|
onClick: (function(state) {
|
||||||
btn.state(nextState);
|
return function(btn) {
|
||||||
self.setProvider(nextState);
|
btn.state(state);
|
||||||
}
|
self.setProvider(state);
|
||||||
|
};
|
||||||
|
})(nextState)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,12 +148,7 @@ var HotLineQualityProvider = L.Class.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flatLines.length > 0) {
|
if (flatLines.length > 0) {
|
||||||
var hotlineOptions = {
|
var hotlineOptions = L.extend({}, this.hotlineOptions);
|
||||||
min: this.hotlineOptions.min,
|
|
||||||
max: this.hotlineOptions.max,
|
|
||||||
palette: this.hotlineOptions.palette,
|
|
||||||
renderer: this.hotlineOptions.renderer
|
|
||||||
};
|
|
||||||
if (!hotlineOptions.min && !hotlineOptions.max) {
|
if (!hotlineOptions.min && !hotlineOptions.max) {
|
||||||
var minMax = this._calcMinMaxValues(flatLines);
|
var minMax = this._calcMinMaxValues(flatLines);
|
||||||
hotlineOptions.min = minMax.min;
|
hotlineOptions.min = minMax.min;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue