refactoring: extract routing styles to config
This commit is contained in:
parent
af9733a4dd
commit
521660ca15
2 changed files with 21 additions and 20 deletions
20
config.js
20
config.js
|
|
@ -85,6 +85,26 @@
|
||||||
// 0 = no minimum, use stored setting; 1 = always reset to full visibility on load
|
// 0 = no minimum, use stored setting; 1 = always reset to full visibility on load
|
||||||
BR.conf.minOpacity = 0.3;
|
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
|
// transit (intermodal routing) demo config
|
||||||
if (BR.conf.transit) {
|
if (BR.conf.transit) {
|
||||||
|
|
|
||||||
21
js/index.js
21
js/index.js
|
|
@ -159,26 +159,7 @@
|
||||||
routing: {
|
routing: {
|
||||||
router: L.bind(router.getRouteSegment, router)
|
router: L.bind(router.getRouteSegment, router)
|
||||||
},
|
},
|
||||||
styles: {
|
styles: 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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function(evt) {
|
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function(evt) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue