determine route color only once
This commit is contained in:
parent
847c2af516
commit
6d3b4b9c60
1 changed files with 4 additions and 1 deletions
|
@ -56,6 +56,8 @@ c3nav = {
|
||||||
continue_init: function() {
|
continue_init: function() {
|
||||||
c3nav.init_map();
|
c3nav.init_map();
|
||||||
|
|
||||||
|
c3nav._route_color = $('.leaflet-control-attribution a:not(:hover)').css('color');
|
||||||
|
|
||||||
$('.locationinput').data('location', null);
|
$('.locationinput').data('location', null);
|
||||||
|
|
||||||
var $main = $('main'),
|
var $main = $('main'),
|
||||||
|
@ -403,12 +405,13 @@ c3nav = {
|
||||||
point = [destination[0]+Math.cos(angle)*offset, destination[1]+Math.sin(angle)*offset];
|
point = [destination[0]+Math.cos(angle)*offset, destination[1]+Math.sin(angle)*offset];
|
||||||
return [origin, point, destination];
|
return [origin, point, destination];
|
||||||
},
|
},
|
||||||
|
_route_color: null,
|
||||||
_add_line_to_route: function(level, coords, gray, link_to_level) {
|
_add_line_to_route: function(level, coords, gray, link_to_level) {
|
||||||
if (coords.length < 2) return;
|
if (coords.length < 2) return;
|
||||||
var latlngs = L.GeoJSON.coordsToLatLngs(c3nav._smooth_line(coords)),
|
var latlngs = L.GeoJSON.coordsToLatLngs(c3nav._smooth_line(coords)),
|
||||||
routeLayer = c3nav._routeLayers[level];
|
routeLayer = c3nav._routeLayers[level];
|
||||||
line = L.polyline(latlngs, {
|
line = L.polyline(latlngs, {
|
||||||
color: gray ? '#888888': $('.leaflet-control-attribution a:not(:hover)').css('color'),
|
color: gray ? '#888888': c3nav._route_color,
|
||||||
dashArray: (gray || link_to_level) ? '7' : null,
|
dashArray: (gray || link_to_level) ? '7' : null,
|
||||||
interactive: false,
|
interactive: false,
|
||||||
smoothFactor: 0.5
|
smoothFactor: 0.5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue