allow more states via number input

This commit is contained in:
Azgaar 2022-01-16 19:37:16 +03:00
parent 207b564180
commit 214bc7a40d
4 changed files with 5 additions and 5 deletions

View file

@ -1062,7 +1062,7 @@
<input id="regionsInput" data-stored="regions" type="range" min=0 max=99 value=13>
</td>
<td>
<input id="regionsOutput" data-stored="regions" type="number" min=0 max=99 value=13>
<input id="regionsOutput" data-stored="regions" type="number" min=0 max=999 value=13>
</td>
</tr>

View file

@ -31,7 +31,7 @@ window.BurgsAndStates = (function () {
function placeCapitals() {
TIME && console.time("placeCapitals");
let count = +regionsInput.value;
let count = +regionsOutput.value;
let burgs = [0];
const rand = () => 0.5 + Math.random() * 0.5;

View file

@ -938,7 +938,7 @@ function applyDefaultStyle() {
.attr("stroke-linecap", "round");
legend.select("#legendBox").attr("fill", "#ffffff").attr("fill-opacity", 0.8);
const citiesSize = Math.max(rn(8 - regionsInput.value / 20), 3);
const citiesSize = Math.max(rn(8 - regionsOutput.value / 20), 3);
burgLabels
.select("#cities")
.attr("fill", "#3e3e4b")
@ -979,7 +979,7 @@ function applyDefaultStyle() {
.attr("stroke-linecap", "butt");
anchors.select("#towns").attr("opacity", 1).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("stroke-width", 1.2).attr("size", 1);
const stateLabelSize = Math.max(rn(24 - regionsInput.value / 6), 6);
const stateLabelSize = Math.max(rn(24 - regionsOutput.value / 6), 6);
labels
.select("#states")
.attr("fill", "#3e3e4b")

View file

@ -143,7 +143,7 @@ function regenerateStates() {
const localSeed = Math.floor(Math.random() * 1e9); // new random seed
Math.random = aleaPRNG(localSeed);
const statesCount = +regionsInput.value;
const statesCount = +regionsOutput.value;
const burgs = pack.burgs.filter(b => b.i && !b.removed);
if (!burgs.length) return tip("There are no any burgs to generate states. Please create burgs first", false, "error");
if (burgs.length < statesCount) tip(`Not enough burgs to generate ${statesCount} states. Will generate only ${burgs.length} states`, false, "warn");