From c4e1490ddaf20c2c364cd452270222b883faa149 Mon Sep 17 00:00:00 2001 From: root <165865819+brianshea2@users.noreply.github.com> Date: Thu, 24 Oct 2024 02:03:20 +0000 Subject: [PATCH] rearrange dark mode toggle, zoom, geolocate controls --- website/index.html | 81 +++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 47 deletions(-) diff --git a/website/index.html b/website/index.html index aee2963..c73ab3f 100644 --- a/website/index.html +++ b/website/index.html @@ -13,18 +13,22 @@ @@ -165,9 +178,11 @@ marker: false, moveToLocation: (_, s) => showNode(nodesBySearchString[s]), })) + // add zoom control + L.control.zoom({position: 'topright'}).addTo(map) // add geolocation control L.easyButton({ - position: 'topleft', + position: 'topright', states: [ { stateName: 'geolocation-button', @@ -182,34 +197,6 @@ }, ], }).addTo(map) - // add theme control - L.easyButton({ - position: 'topright', - states: [ - { - stateName: 'theme-light', - title: 'Toggle dark mode', - icon: 'fa-sun-o', - onClick: btn => { - const dark = document.body.classList.toggle('dark') - window.localStorage.setItem('theme', dark ? 'dark' : 'light') - btn.state(dark ? 'theme-dark' : 'theme-light') - }, - }, - { - stateName: 'theme-dark', - title: 'Toggle dark mode', - icon: 'fa-moon-o', - onClick: btn => { - const dark = document.body.classList.toggle('dark') - window.localStorage.setItem('theme', dark ? 'dark' : 'light') - btn.state(dark ? 'theme-dark' : 'theme-light') - }, - }, - ], - }).state(document.body.classList.contains('dark') ? 'theme-dark' : 'theme-light').addTo(map) - // add zoom control - L.control.zoom({position: 'bottomleft'}).addTo(map) // track and store map position map.on('moveend', () => { const center = map.getCenter()