-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved map style settings to a different script
- Loading branch information
1 parent
a5a5267
commit 9f9970b
Showing
3 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function mapStyleSettings() { | ||
resetContentPart2(); | ||
const names = ["game", "render", "print"]; | ||
const namesDisp = ["In Game", "Satellite", "Game Manual"]; | ||
|
||
let optionDiv = document.createElement("div"); | ||
optionDiv.innerHTML = "Map Style"; | ||
|
||
let interactiveDiv = document.createElement("div"); | ||
|
||
let img1 = document.createElement("img"); | ||
img1.src = "./websiteIcons/small_arr_left.svg"; | ||
interactiveDiv.appendChild(img1); | ||
|
||
interactiveDiv.innerHTML += `<p>${ | ||
namesDisp[names.indexOf(saveData.selectedTileLayer)] | ||
}</p>`; | ||
|
||
let img2 = document.createElement("img"); | ||
img2.src = "./websiteIcons/small_arr_right.svg"; | ||
interactiveDiv.appendChild(img2); | ||
|
||
interactiveDiv.style = "display: flex; align-items: center;"; | ||
optionDiv.appendChild(interactiveDiv); | ||
|
||
contentPart2.append(optionDiv); | ||
|
||
function refreshMap(idx) { | ||
interactiveDiv.children[1].innerHTML = namesDisp[idx]; | ||
constantData.tileLayers.mainMap[saveData.selectedTileLayer].remove(); | ||
saveData.selectedTileLayer = names[idx]; | ||
saveDataSave(); | ||
constantData.tileLayers.mainMap[saveData.selectedTileLayer].addTo(map); | ||
document.getElementById("map").style.background = | ||
constantData.oceanColors.mainMap[saveData.selectedTileLayer]; | ||
} | ||
|
||
optionDiv.addEventListener("click", function () { | ||
let idx = names.indexOf(saveData.selectedTileLayer) + 1; | ||
if (idx === 3) idx = 0; | ||
refreshMap(idx); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters