feat: add info banner
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 42s
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 42s
This commit is contained in:
parent
aea400e306
commit
4efa212d00
1 changed files with 18 additions and 3 deletions
|
@ -8,6 +8,9 @@
|
|||
const linesUrl =
|
||||
"https://data.grandlyon.com/geoserver/sytral/ows?SERVICE=WFS&VERSION=2.0.0&request=GetFeature&typename=sytral:tcl_sytral.tcllignemf_2_0_0&outputFormat=application/json&SRSNAME=EPSG:4171&sortBy=gid";
|
||||
|
||||
let distance = +Infinity;
|
||||
$: points = 5000 * Math.exp(-distance / 750);
|
||||
|
||||
onMount(async () => {
|
||||
const L = (await import("leaflet")).default;
|
||||
|
||||
|
@ -43,16 +46,28 @@
|
|||
});
|
||||
}
|
||||
|
||||
const marker = L.marker([centerLat, centerLon]);
|
||||
map.on("click", (e) => marker.setLatLng(e.latlng).addTo(map));
|
||||
const marker = L.marker([0, 0]);
|
||||
map.on("click", (e) => {
|
||||
marker.setLatLng(e.latlng).addTo(map);
|
||||
// allow 20m of error
|
||||
distance = Math.max(0, e.latlng.distanceTo([45.75388713, 4.84715287]) - 20);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="info">
|
||||
<span>distance: {distance}, points: {points}</span>
|
||||
</div>
|
||||
|
||||
<div id="map"></div>
|
||||
|
||||
<style>
|
||||
#info {
|
||||
height: 5vh;
|
||||
}
|
||||
|
||||
#map {
|
||||
height: 100vh;
|
||||
height: 95vh;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue