restring layers off on heightmap edit

This commit is contained in:
Azgaar 2021-04-18 22:03:57 +03:00
parent 6f08c87015
commit 886ea38b44
2 changed files with 6 additions and 2 deletions

View file

@ -419,7 +419,7 @@
lineGen.curve(d3.curveBundle.beta(1)); lineGen.curve(d3.curveBundle.beta(1));
for (const s of states) { for (const s of states) {
if (!s.i || s.removed || (list && !list.includes(s.i))) continue; if (!s.i || s.removed || !s.cells || (list && !list.includes(s.i))) continue;
const used = []; const used = [];
const visualCenter = findCell(s.pole[0], s.pole[1]); const visualCenter = findCell(s.pole[0], s.pole[1]);
const start = cells.state[visualCenter] === s.i ? visualCenter : s.center; const start = cells.state[visualCenter] === s.i ? visualCenter : s.center;

View file

@ -120,13 +120,17 @@ function restoreLayers() {
} }
function toggleHeight(event) { function toggleHeight(event) {
if (customization === 1) {
tip("You cannot turn off the layer when heightmap is in edit mode", false, "error");
return;
}
if (!terrs.selectAll("*").size()) { if (!terrs.selectAll("*").size()) {
turnButtonOn("toggleHeight"); turnButtonOn("toggleHeight");
drawHeightmap(); drawHeightmap();
if (event && isCtrlClick(event)) editStyle("terrs"); if (event && isCtrlClick(event)) editStyle("terrs");
} else { } else {
if (event && isCtrlClick(event)) {editStyle("terrs"); return;} if (event && isCtrlClick(event)) {editStyle("terrs"); return;}
if (customization === 1) {tip("You cannot turn off the layer when heightmap is in edit mode", false, "error"); return;}
turnButtonOff("toggleHeight"); turnButtonOff("toggleHeight");
terrs.selectAll("*").remove(); terrs.selectAll("*").remove();
} }