feat: add coordinate display to map
This commit is contained in:
parent
e3d70829ec
commit
bf980cede0
|
@ -31,6 +31,7 @@
|
||||||
{% if pageTitle == 'Map' %}
|
{% if pageTitle == 'Map' %}
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
|
||||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/leaflet-mouse-position@1.2.0/src/L.Control.MousePosition.min.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#map { height: 100vh; }
|
#map { height: 100vh; }
|
||||||
|
@ -52,6 +53,17 @@
|
||||||
img.leaflet-tile {
|
img.leaflet-tile {
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leaflet-control-mouseposition {
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 6px;
|
||||||
|
|
||||||
|
width: calc(100% - 2 * 6px);
|
||||||
|
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
let map = L.map('map', {
|
let map = L.map('map', {
|
||||||
layers: [mapLayer, markers],
|
layers: [mapLayer, markers],
|
||||||
crs: L.CRS.Simple,
|
crs: L.CRS.Simple,
|
||||||
}).setView([0, 0], 4);
|
}).setView([0, 0], 2);
|
||||||
|
|
||||||
let baseMaps = {
|
let baseMaps = {
|
||||||
"Overworld": mapLayer
|
"Overworld": mapLayer
|
||||||
|
@ -62,6 +62,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
let layerControl = L.control.layers(baseMaps, overlayMaps).addTo(map);
|
let layerControl = L.control.layers(baseMaps, overlayMaps).addTo(map);
|
||||||
|
|
||||||
|
L.control.mousePosition({
|
||||||
|
position: 'bottomright',
|
||||||
|
separator: '; '
|
||||||
|
}).addTo(map);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% include 'includes/foot.twig' %}
|
{% include 'includes/foot.twig' %}
|
Loading…
Reference in a new issue