diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index 2213edac..5524e81d 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -419,7 +419,7 @@ lineGen.curve(d3.curveBundle.beta(1)); 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 visualCenter = findCell(s.pole[0], s.pole[1]); const start = cells.state[visualCenter] === s.i ? visualCenter : s.center; diff --git a/modules/ui/layers.js b/modules/ui/layers.js index 3743e5fa..0b640309 100644 --- a/modules/ui/layers.js +++ b/modules/ui/layers.js @@ -120,13 +120,17 @@ function restoreLayers() { } 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()) { turnButtonOn("toggleHeight"); drawHeightmap(); if (event && isCtrlClick(event)) editStyle("terrs"); } else { 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"); terrs.selectAll("*").remove(); }