refactoring: extract routing styles to config

This commit is contained in:
Norbert Renner 2016-08-05 12:55:15 +02:00
parent af9733a4dd
commit 521660ca15
2 changed files with 21 additions and 20 deletions

View file

@ -85,6 +85,26 @@
// 0 = no minimum, use stored setting; 1 = always reset to full visibility on load
BR.conf.minOpacity = 0.3;
BR.conf.routingStyles = {
trailer: {
dashArray: [10, 10],
opacity: 0.6,
color: 'magenta'
},
track: {
color: 'magenta',
opacity: BR.conf.defaultOpacity
},
trackCasing: {
weight: 8,
color: 'white',
// assumed to be same as track, see setOpacity
opacity: BR.conf.defaultOpacity
},
nodata: {
color: 'darkred'
}
};
// transit (intermodal routing) demo config
if (BR.conf.transit) {

View file

@ -159,26 +159,7 @@
routing: {
router: L.bind(router.getRouteSegment, router)
},
styles: {
trailer: {
dashArray: [10, 10],
opacity: 0.6,
color: 'magenta'
},
track: {
color: 'magenta',
opacity: BR.conf.defaultOpacity
},
trackCasing: {
weight: 8,
color: 'white',
// assumed to be same as track, see setOpacity
opacity: BR.conf.defaultOpacity
},
nodata: {
color: 'darkred'
}
}
styles: BR.conf.routingStyles
});
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function(evt) {