Skip to content

Commit

Permalink
different color for trals onn sattelite
Browse files Browse the repository at this point in the history
  • Loading branch information
bvandercar-vt committed Jun 20, 2024
1 parent a048cbc commit f7a75f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,20 @@ const overlayMaps = {

control.layers(baseMaps, overlayMaps, { position: 'topleft', collapsed: false }).addTo(map)

// TODO: change trails color when on sattelite view (map.on('baselayerchange')
function setBikeTrailsStyle(isSatellite: boolean) {
const bikeTrails = document.getElementsByClassName('bike-trails')[0]! as HTMLElement
bikeTrails.classList.toggle('bike-trails-satellite', isSatellite)
bikeTrails.classList.toggle('bike-trails-dark', !isSatellite)
}
map.on('baselayerchange', (e) => {
const isSatellite = e.name === 'Satellite'
setBikeTrailsStyle(isSatellite)
})

map.on('overlayadd', () => {
const isSatellite = map.hasLayer(satelliteLayer)
setBikeTrailsStyle(isSatellite)
})

const lineStyle: PathOptions = {
color: 'lime',
Expand Down
6 changes: 5 additions & 1 deletion src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ header {
background-color: var(--popup-bg-color);
}

.bike-trails {
.bike-trails-dark {
filter: invert(100%) hue-rotate(350deg) saturate(1.5) brightness(85%) contrast(100%);
}

.bike-trails-satellite {
filter: invert(0%) hue-rotate(120deg) saturate(2) brightness(100%) contrast(100%);
}

0 comments on commit f7a75f9

Please sign in to comment.