mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Fix for 3d heightmap / 3d view conflict (#360)
This commit is contained in:
parent
354eb74746
commit
257cf11986
2 changed files with 21 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ function editHeightmap() {
|
||||||
<p>If you need to change the coastline and keep the data, you may try the <i>risk</i> edit option.
|
<p>If you need to change the coastline and keep the data, you may try the <i>risk</i> edit option.
|
||||||
The data will be restored as much as possible, but the coastline change can cause unexpected fluctuations and errors.</p>
|
The data will be restored as much as possible, but the coastline change can cause unexpected fluctuations and errors.</p>
|
||||||
<p>Check out ${link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Heightmap-customization", "wiki")} for guidance.</p>
|
<p>Check out ${link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Heightmap-customization", "wiki")} for guidance.</p>
|
||||||
<p>Please <span class="pseudoLink" onclick=saveMap(); editHeightmap();>save the map</span> before edditing the heightmap!</p>`;
|
<p>Please <span class="pseudoLink" onclick=saveMap(); editHeightmap();>save the map</span> before editing the heightmap!</p>`;
|
||||||
|
|
||||||
$("#alert").dialog({resizable: false, title: "Edit Heightmap", width: "28em",
|
$("#alert").dialog({resizable: false, title: "Edit Heightmap", width: "28em",
|
||||||
buttons: {
|
buttons: {
|
||||||
|
|
@ -43,6 +43,9 @@ function editHeightmap() {
|
||||||
editHeightmap.layers = Array.from(mapLayers.querySelectorAll("li:not(.buttonoff)")).map(node => node.id); // store layers preset
|
editHeightmap.layers = Array.from(mapLayers.querySelectorAll("li:not(.buttonoff)")).map(node => node.id); // store layers preset
|
||||||
editHeightmap.layers.forEach(l => document.getElementById(l).click()); // turn off all layers
|
editHeightmap.layers.forEach(l => document.getElementById(l).click()); // turn off all layers
|
||||||
|
|
||||||
|
enterStandardView();
|
||||||
|
disable3dViews();
|
||||||
|
|
||||||
customization = 1;
|
customization = 1;
|
||||||
closeDialogs();
|
closeDialogs();
|
||||||
tip('Heightmap edit mode is active. Click on "Exit Customization" to finalize the heightmap', true);
|
tip('Heightmap edit mode is active. Click on "Exit Customization" to finalize the heightmap', true);
|
||||||
|
|
@ -109,6 +112,8 @@ function editHeightmap() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enable3dViews();
|
||||||
|
|
||||||
customization = 0;
|
customization = 0;
|
||||||
customizationMenu.style.display = "none";
|
customizationMenu.style.display = "none";
|
||||||
toolsContent.style.display = "block";
|
toolsContent.style.display = "block";
|
||||||
|
|
|
||||||
|
|
@ -432,6 +432,7 @@ function changeViewMode(event) {
|
||||||
const button = event.target;
|
const button = event.target;
|
||||||
|
|
||||||
enterStandardView();
|
enterStandardView();
|
||||||
|
|
||||||
if (button.classList.contains("pressed")) {
|
if (button.classList.contains("pressed")) {
|
||||||
button.classList.remove("pressed");
|
button.classList.remove("pressed");
|
||||||
viewStandard.classList.add("pressed");
|
viewStandard.classList.add("pressed");
|
||||||
|
|
@ -442,7 +443,20 @@ function changeViewMode(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function disable3dViews() {
|
||||||
|
viewMesh.disabled = true;
|
||||||
|
viewGlobe.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable3dViews() {
|
||||||
|
viewMesh.disabled = false;
|
||||||
|
viewGlobe.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
function enterStandardView() {
|
function enterStandardView() {
|
||||||
|
viewMode.querySelectorAll(".pressed").forEach(button => button.classList.remove("pressed"));
|
||||||
|
viewStandard.classList.add("pressed");
|
||||||
|
|
||||||
if (!document.getElementById("canvas3d")) return;
|
if (!document.getElementById("canvas3d")) return;
|
||||||
ThreeD.stop();
|
ThreeD.stop();
|
||||||
document.getElementById("canvas3d").remove();
|
document.getElementById("canvas3d").remove();
|
||||||
|
|
@ -555,4 +569,4 @@ function toggle3dOptions() {
|
||||||
function changeResolution() {
|
function changeResolution() {
|
||||||
ThreeD.setResolution(this.value);
|
ThreeD.setResolution(this.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue