diff --git a/index.html b/index.html index 490729d..5f9756c 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,7 @@

My Bike Rides

+
Trails Layer
diff --git a/src/main.ts b/src/main.ts index 9f7e380..dd76197 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,6 +46,18 @@ tileLayer(`https://api.maptiler.com/maps/streets-v2-dark/{z}/{x}/{y}.png?key=${M crossOrigin: true, }).addTo(map) +const bikeLayer = tileLayer('http://{s}.google.com/vt/lyrs=bike&x={x}&y={y}&z={z}', { + maxZoom: 20, + subdomains: ['mt0', 'mt1', 'mt2', 'mt3'], + opacity: 0, + className: 'bike-trails', +}).addTo(map) + +const bikeTrailCheckbox = document.getElementById('trail-layer-checkbox')! as HTMLInputElement +bikeTrailCheckbox.addEventListener('change', (event) => { + bikeLayer.setOpacity((event.currentTarget as HTMLInputElement)?.checked ? 0.5 : 0) +}) + const lineStyle: PathOptions = { color: 'lime', weight: 3, diff --git a/src/styles/index.css b/src/styles/index.css index 04e1da0..65bd8c9 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -69,3 +69,22 @@ header { .leaflet-popup-tip { background-color: var(--popup-bg-color); } + +.bike-trails { + filter: invert(100%) hue-rotate(350deg) saturate(1.5) brightness(85%) contrast(100%); +} + +#checkbox-overlay { + position: absolute; + z-index: 3; + top: 0; + right: 0; + padding: 0.2em; + margin: 0.1em; + + font-family: Arial, Helvetica, sans-serif; + font-size: 1em; + color: orange; + background-color: rgba(0, 0, 0, 0.6); + border-radius: 5px; +}