From 886ea38b44b449563ada5e541a72166a916fb2ce Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 18 Apr 2021 22:03:57 +0300 Subject: [PATCH] restring layers off on heightmap edit --- modules/burgs-and-states.js | 2 +- modules/ui/layers.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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(); }