added topography

This commit is contained in:
barrulus 2025-09-04 16:21:22 +01:00
parent 21df872ca2
commit 2c3692f000
5 changed files with 151 additions and 1 deletions

View file

@ -186,6 +186,7 @@ function drawLayers() {
drawFeatures();
if (layerIsOn("toggleTexture")) drawTexture();
if (layerIsOn("toggleHeight")) drawHeightmap();
if (layerIsOn("toggleTopography")) drawTopography();
if (layerIsOn("toggleBiomes")) drawBiomes();
if (layerIsOn("toggleCells")) drawCells();
if (layerIsOn("toggleGrid")) drawGrid();
@ -229,6 +230,18 @@ function toggleHeight(event) {
}
}
function toggleTopography(event) {
const group = d3.select('#topography');
const hasContent = group.selectAll('*').size() > 0;
if (!hasContent) {
turnButtonOn('toggleTopography');
drawTopography();
} else {
turnButtonOff('toggleTopography');
group.selectAll('*').remove();
}
}
function toggleTemperature(event) {
if (!temperature.selectAll("*").size()) {
turnButtonOn("toggleTemperature");
@ -1015,6 +1028,7 @@ function moveLayer(event, ui) {
// define connection between option layer buttons and actual svg groups to move the element
function getLayer(id) {
if (id === "toggleHeight") return $("#terrs");
if (id === "toggleTopography") return $("#topography");
if (id === "toggleBiomes") return $("#biomes");
if (id === "toggleCells") return $("#cells");
if (id === "toggleGrid") return $("#gridOverlay");