From 90c87853b1253996ce2f5b2cc1f24e74d3f93715 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 31 Jul 2021 15:06:14 +0300 Subject: [PATCH] restore layers - don't hide, remove unused --- modules/ui/layers.js | 22 ++++++++++++---------- modules/ui/options.js | 8 ++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/ui/layers.js b/modules/ui/layers.js index 7b9d23f4..f75b4277 100644 --- a/modules/ui/layers.js +++ b/modules/ui/layers.js @@ -122,9 +122,10 @@ function restoreLayers() { if (layerIsOn("toggleIce")) drawIce(); if (layerIsOn("toggleEmblems")) drawEmblems(); - // states are getting rendered each time, if it's not required than layers should be hidden - if (!layerIsOn("toggleBorders")) $("#borders").fadeOut(); - if (!layerIsOn("toggleStates")) regions.style("display", "none").selectAll("path").remove(); + // some layers are rendered each time, remove them if they are not on + if (!layerIsOn("toggleBorders")) borders.selectAll("path").remove(); + if (!layerIsOn("toggleStates")) regions.selectAll("path").remove(); + if (!layerIsOn("toggleRivers")) rivers.selectAll("*").remove(); } function toggleHeight(event) { @@ -1034,13 +1035,14 @@ function drawBorders() { TIME && console.time("drawBorders"); borders.selectAll("path").remove(); - const cells = pack.cells, - vertices = pack.vertices, - n = cells.i.length; - const sPath = [], - pPath = []; - const sUsed = new Array(pack.states.length).fill("").map(a => []); - const pUsed = new Array(pack.provinces.length).fill("").map(a => []); + const {cells, vertices} = pack; + const n = cells.i.length; + + const sPath = []; + const pPath = []; + + const sUsed = new Array(pack.states.length).fill("").map(_ => []); + const pUsed = new Array(pack.provinces.length).fill("").map(_ => []); for (let i = 0; i < cells.i.length; i++) { if (!cells.state[i]) continue; diff --git a/modules/ui/options.js b/modules/ui/options.js index 9d8b43df..8538e4bb 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -544,15 +544,15 @@ function randomizeHeightmapTemplate() { volcano: 3, highIsland: 22, lowIsland: 9, - continents: 20, - archipelago: 25, - mediterranean: 3, + continents: 19, + archipelago: 23, + mediterranean: 5, peninsula: 3, pangea: 5, isthmus: 2, atoll: 1, shattered: 7, - taklamakan: 2 + taklamakan: 1 }; document.getElementById("templateInput").value = rw(templates); }