Add toggle to use real or nice yellow colors

pull/3/head
Jelmer van der Linde 2017-09-16 12:02:13 +02:00
rodzic 98d44fd133
commit fde1d9e8ce
1 zmienionych plików z 23 dodań i 1 usunięć

Wyświetl plik

@ -11,16 +11,31 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 100%; height: 100%;
font: 12px/16px sans-serif;
color: white;
} }
#seamap { #seamap {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
#controls {
position: fixed;
bottom: 10px;
left: 10px;
z-index: 1000;
}
</style> </style>
</head> </head>
<body> <body>
<div id="seamap"></div> <div id="seamap"></div>
<div id="controls">
<label>
<input name="real-colors" type="checkbox">
Show real colors
</label>
</div>
<script id="seamap-query" type="text/x-overpass"> <script id="seamap-query" type="text/x-overpass">
[out:json][timeout:25]; [out:json][timeout:25];
// gather results // gather results
@ -122,11 +137,18 @@
} }
}).addTo(map).addData(geojson); }).addTo(map).addData(geojson);
}); });
let useRealColors = false;
document.querySelector('input[name=real-colors]').addEventListener('change', function(e) {
useRealColors = this.checked;
});
lights.then(layer => { lights.then(layer => {
let draw = function(t) { let draw = function(t) {
layer.eachVisibleLayer(marker => { layer.eachVisibleLayer(marker => {
marker.setColor(marker.options.sequence.state(t)); let state = marker.options.sequence.state(t);
marker.setColor(state ? (useRealColors ? state : '#FF0') : false);
}); });
}; };