forked from blurryface/Website
feat: add center option to map
This commit is contained in:
parent
8aa128d0e2
commit
bfd6326be6
|
@ -63,6 +63,11 @@
|
||||||
|
|
||||||
$twig->addGlobal('pageUri', '/map');
|
$twig->addGlobal('pageUri', '/map');
|
||||||
|
|
||||||
|
if(isset($_GET['center']))
|
||||||
|
$twig->addGlobal('center', $_GET['center']);
|
||||||
|
else
|
||||||
|
$twig->addGlobal('center', '0;0');
|
||||||
|
|
||||||
echo $twig->render('map.twig');
|
echo $twig->render('map.twig');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ let map = L.map('map', {
|
||||||
transformation: new L.Transformation(1, 0, 1, 0),
|
transformation: new L.Transformation(1, 0, 1, 0),
|
||||||
projection: L.Projection.LonLat
|
projection: L.Projection.LonLat
|
||||||
}),
|
}),
|
||||||
}).setView([0, 0], 2);
|
}).setView([ parseInt(center.split(';')[1]), parseInt(center.split(';')[0])], 2);
|
||||||
|
|
||||||
let baseMaps = {
|
let baseMaps = {
|
||||||
"Overworld": mapLayer
|
"Overworld": mapLayer
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<a id="homeLink" href="/">Go Home</a>
|
<a id="homeLink" href="/">Go Home</a>
|
||||||
|
|
||||||
|
<script>const center = "{{ center }}";</script>
|
||||||
<script src="js/map.js"></script>
|
<script src="js/map.js"></script>
|
||||||
|
|
||||||
{% include 'includes/foot.twig' %}
|
{% include 'includes/foot.twig' %}
|
Loading…
Reference in a new issue