Added Map tileset toggle
This commit is contained in:
@@ -137,8 +137,11 @@
|
||||
</div>
|
||||
<div class="row hidden" id="map-row">
|
||||
<div id="preorder-map" style="height:70vh; width: 100%"></div>
|
||||
<div class="mt-1">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="centerMap()"><i class="far fa-dot-circle"></i> Zentrieren</button>
|
||||
<div class="row mt-1">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="centerMap()"><i class="far fa-dot-circle fa-fw"></i> Zentrieren</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-success" onclick="toggleTileset()"><i class="far fa-arrow-right-arrow-left fa-fw"></i> Karte/Satellit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -306,6 +309,18 @@
|
||||
var markers = [];
|
||||
var markerState = true;
|
||||
var mapCenterPos = [<?=TT_PLACEHOLDER_GPS_LAT?>, <?=TT_PLACEHOLDER_GPS_LONG?>];
|
||||
var currentTileset = "mapbox/streets-v12";
|
||||
|
||||
function toggleTileset() {
|
||||
if(currentTileset == "mapbox/streets-v12") {
|
||||
currentTileset = "mapbox/satellite-streets-v12";
|
||||
} else {
|
||||
currentTileset = "mapbox/streets-v12";
|
||||
}
|
||||
|
||||
console.log("renderMap");
|
||||
renderMap();
|
||||
}
|
||||
|
||||
function refreshMap() {
|
||||
// get Preorders and render map
|
||||
@@ -330,7 +345,9 @@
|
||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||
minZoom: 4,
|
||||
maxZoom: 22,
|
||||
id: 'mapbox/streets-v11',
|
||||
//id: 'mapbox/streets-v12',
|
||||
//id: 'mapbox/satellite-streets-v12',
|
||||
id: currentTileset,
|
||||
accessToken: '<?=TT_MAPBOX_TILE_API_TOKEN?>'
|
||||
}).addTo(preorderMap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user