This commit is contained in:
Zsolt Ero
2024-01-19 20:28:50 +01:00
parent f2cbfd5fb8
commit 7429a52f8b
6 changed files with 34 additions and 18 deletions

View File

@@ -1,22 +1,30 @@
const map = new maplibregl.Map({
style: 'https://tiles.openfreemap.org/styles/liberty',
center: [-0.114, 51.506],
zoom: 14.2,
bearing: 55.2,
pitch: 60,
container: 'map',
boxZoom: false,
doubleClickZoom: false,
scrollZoom: false,
})
function initMap(div) {
const map = new maplibregl.Map({
style: 'https://tiles.openfreemap.org/styles/liberty',
center: [-0.114, 51.506],
zoom: 14.2,
bearing: 55.2,
pitch: 60,
container: div,
// boxZoom: false,
// doubleClickZoom: false,
// scrollZoom: false,
})
window.map = map
let nav = new maplibregl.NavigationControl({ showCompass: false })
map.addControl(nav, 'top-right')
let nav = new maplibregl.NavigationControl({ showCompass: false })
map.addControl(nav, 'top-right')
let scale = new maplibregl.ScaleControl()
map.addControl(scale)
let scale = new maplibregl.ScaleControl()
map.addControl(scale)
new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map)
new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map)
}
const mapDiv = document.getElementById('map')
mapDiv.onclick = function () {
initMap(mapDiv)
}
function selectStyle(style) {
const styleUrl = 'https://tiles.openfreemap.org/styles/' + style