Skip to content

Commit e6dfab4

Browse files
author
Azgaar
authored
V1.8 (#784)
* pump version to 1.8 * resampleDialog UI update * don't draw markers if not required * submapOptionsDialog style changes
1 parent 8a0fbd1 commit e6dfab4

File tree

7 files changed

+140
-148
lines changed

7 files changed

+140
-148
lines changed

index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,7 @@ svg.button {
22712271
user-select: none;
22722272
}
22732273

2274+
22742275
.dontAsk {
22752276
display: inline-block;
22762277
margin: 0.9em 0 0 0.6em;

index.html

Lines changed: 60 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
<div id="loading">
275275
<div id="titleName"><t data-t="titleName">Azgaar's</t></div>
276276
<div id="title"><t data-t="title">Fantasy Map Generator</t></div>
277-
<div id="version"><t data-t="version">v. </t>1.73</div>
277+
<div id="version"><t data-t="version">v. </t>1.8</div>
278278
<p id="loading-text"><t data-t="loading">LOADING</t><span>.</span><span>.</span><span>.</span></p>
279279
</div>
280280

@@ -1247,7 +1247,7 @@
12471247
<input id="pointsInput" type="range" min="1" max="13" value="4" data-cells="10000" />
12481248
</td>
12491249
<td>
1250-
<output id="pointsOutput_formatted" style="color: #053305">10K</output>
1250+
<output id="pointsOutputFormatted" style="color: #053305">10K</output>
12511251
</td>
12521252
</tr>
12531253

@@ -1727,9 +1727,9 @@
17271727
</div>
17281728

17291729
<p>Click to create a new map:</p>
1730-
<div id="resamplers">
1731-
<button data-tip="Click to generate new (sub)map from the current viewport" onclick="UISubmap.openSubmapOptions()">Submap</button>
1732-
<button data-tip="Click to resample (transform) your map to different cellcount" onclick="UISubmap.openRemapOptions()">Resample</button>
1730+
<div>
1731+
<button id="openSubmapMenu" data-tip="Click to generate a submap from the current viewport">Submap</button>
1732+
<button id="openResampleMenu" data-tip="Click to transform the map">Resample</button>
17331733
</div>
17341734
</div>
17351735

@@ -4444,99 +4444,79 @@
44444444
<div id="tileStatus" style="background-color: #33333310; font-style: italic"></div>
44454445
</div>
44464446

4447-
<div id="remapOptionsDialog" style="display: none; max-width: 300px" class="dialog">
4448-
<p style="font-style: italic; color: red; font-weight: bold">Warning! This operation is destructive and irreversible. Don't forget to save your map!</p>
4449-
<table>
4450-
<tr>
4451-
<td>Points number</td>
4452-
<td>
4453-
<input
4454-
id="submapPointsInput"
4455-
autocomplete="off"
4456-
type="range"
4457-
min="1"
4458-
max="13"
4459-
value="4"
4460-
data-cells="10000"
4461-
oninput="document.getElementById('submapPointsOutput').value=cellsDensityConstants[+this.value]/1000 + 'K'; event.stopPropagation()"
4462-
/>
4463-
</td>
4464-
<td>
4465-
<output id="submapPointsOutput" style="color: #053305">10K</output>
4466-
</td>
4467-
</tr>
4468-
<tr>
4469-
<td>Shift</td>
4470-
<td colspan="2">
4471-
X: <input id="submapShiftX" autocomplete="off" min="0" size="4" value="0"/>
4472-
Y: <input id="submapShiftY" autocomplete="off" min="0" size="4" value="0"/>
4473-
</td>
4474-
</tr>
4475-
<tr>
4476-
<td>Rotate <i class="icon-cw"></i></td>
4477-
<td>
4478-
<input
4479-
id="submapRotationAngle"
4480-
autocomplete="off"
4481-
type="range"
4482-
min="0"
4483-
max="359"
4484-
value="0"
4485-
oninput="document.getElementById('submapRotationAngleOutput').value=+this.value + '°'"
4486-
/>
4487-
</td>
4488-
<td>
4489-
<output id="submapRotationAngleOutput" style="color: #053305">0°</output>
4490-
</td>
4491-
</tr>
4492-
<tr>
4493-
<td>Mirror</td>
4494-
<td colspan="2">
4495-
<input type="checkbox" class="checkbox" id="submapMirrorH" />
4496-
<label for="submapMirrorH" class="checkbox-label" >Horizontally</label>
4497-
&nbsp;
4498-
<input type="checkbox" class="checkbox" id="submapMirrorV" />
4499-
<label for="submapMirrorV" class="checkbox-label">Vertically</label>
4500-
</td>
4501-
</tr>
4502-
</table>
4447+
<div id="resampleDialog" style="display: none" class="dialog">
4448+
<p style="font-weight: bold">
4449+
This operation is destructive and irreversible. It will create a completely new map based on the current one. Don't forget to save the current project
4450+
as a .map file first!
4451+
</p>
4452+
<div style="display: grid; grid-template-columns: 2fr 3fr; grid-template-rows: repeat(4, 1fr); align-items: center; padding-left: 0.5em">
4453+
<div>Points number</div>
4454+
<div>
4455+
<input id="submapPointsInput" type="range" min="1" max="13" value="4" />
4456+
<output id="submapPointsOutputFormatted" style="color: #053305">10K</output>
4457+
</div>
4458+
4459+
<div>Shift</div>
4460+
<div>
4461+
<label>X: <input id="submapShiftX" type="number" min="0" size="4" value="0" /></label>
4462+
<label>Y: <input id="submapShiftY" type="number" min="0" size="4" value="0" /></label>
4463+
</div>
4464+
4465+
<div>Rotate</div>
4466+
<div>
4467+
<input id="submapAngleInput" type="range" min="0" max="359" value="0" />
4468+
<output id="submapAngleOutput">0</output>°
4469+
</div>
4470+
4471+
<div>Mirror</div>
4472+
<div>
4473+
<input type="checkbox" class="checkbox" id="submapMirrorH" />
4474+
<label for="submapMirrorH" class="checkbox-label">horizontally</label>
4475+
&nbsp;
4476+
<input type="checkbox" class="checkbox" id="submapMirrorV" />
4477+
<label for="submapMirrorV" class="checkbox-label">vertically</label>
4478+
</div>
4479+
</div>
45034480
</div>
4504-
<div id="submapOptionsDialog" style="display: none; max-width: 300px" class="dialog">
4505-
<p style="font-style: italic; color: red; font-weight: bold">
4506-
Warning! This operation is destructive and irreversible. Don't forget to save your original map!
4481+
4482+
<div id="submapOptionsDialog" style="display: none" class="dialog">
4483+
<p style="font-weight: bold">
4484+
This operation is destructive and irreversible. It will create a completely new map based on the current one. Don't forget to save the current project
4485+
as a .map file first!
45074486
</p>
4508-
<p><em>Settings to be changed:</em> Population rate, map pixel size.</p>
4509-
<p><em>Data to be copied:</em> Heightmap, Biome, Religion, Population, Precipitation, Cultures, States, Provinces, Regiments (military), Markers.</p>
4510-
<p><em>Data to be destroyed (regenerated):</em> Zones, Roads, Rivers (mostly regenerate at the same place).</p>
4511-
<p>Remapping Burgs (cities) may be imprecise, you will need to fix missing or wrongly mapped burgs manually.</p>
4512-
<p>Lock remapped items for:</p>
4513-
<div data-tip="Lock all markers copied from the original map.">
4487+
4488+
<p>Settings to be changed: population rate, map pixel size</p>
4489+
<p>Data to be copied: heightmap, biomes, religions, population, precipitation, cultures, states, provinces, military regiments</p>
4490+
<p>Data to be regenerated: zones, roads, rivers</p>
4491+
<p>Burgs may be remapped incorrectly, manual change is required</p>
4492+
4493+
<p>Keep data for:</p>
4494+
<div data-tip="Lock all markers copied from the original map">
45144495
<input id="submapLockMarkers" class="checkbox" type="checkbox" checked />
45154496
<label for="submapLockMarkers" class="checkbox-label">Markers</label>
45164497
</div>
4517-
<div data-tip="Lock all burgs copied from the original map.">
4498+
<div data-tip="Lock all burgs copied from the original map">
45184499
<input id="submapLockBurgs" class="checkbox" type="checkbox" checked />
4519-
<label for="submapLockBurgs" class="checkbox-label">Burgs (cities)</label>
4500+
<label for="submapLockBurgs" class="checkbox-label">Burgs</label>
45204501
</div>
45214502

4522-
<p>Extra / experimental features:</p>
4523-
<div data-tip="Rivers on the parent map errode land (helps to get similar river network.)">
4503+
<p>Experimental features:</p>
4504+
<div data-tip="Rivers on the parent map will errode land (helps to get similar river network)">
45244505
<input id="submapDepressRivers" class="checkbox" type="checkbox" />
4525-
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds.</label>
4506+
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds</label>
45264507
</div>
4527-
<div data-tip="Rescale styles (burg labels, emblem size) to match the new scale.">
4528-
<input id="submapRescaleStyles" class="checkbox" type="checkbox" checked/>
4529-
<label for="submapRescaleStyles" class="checkbox-label">Rescale Styles</label>
4508+
<div data-tip="Rescale styles (burg labels, emblem size) to match the new scale">
4509+
<input id="submapRescaleStyles" class="checkbox" type="checkbox" checked />
4510+
<label for="submapRescaleStyles" class="checkbox-label">Rescale styles</label>
45304511
</div>
45314512
<div data-tip="Move all existing towns to the 'largetown' burg group">
45324513
<input id="submapPromoteTowns" class="checkbox" type="checkbox" />
45334514
<label for="submapPromoteTowns" class="checkbox-label">Promote towns to largetowns</label>
45344515
</div>
4535-
<div data-tip="Add lakes in depressions. (Can be very slow on big landmasses!)">
4516+
<div data-tip="Add lakes in depressions (can be very slow on big landmasses)">
45364517
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox" />
45374518
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions (slow)</label>
45384519
</div>
4539-
<hr />
45404520
</div>
45414521

45424522
<div id="alert" style="display: none" class="dialog">

main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// https://github.com/Azgaar/Fantasy-Map-Generator
33

44
"use strict";
5-
const version = "1.732"; // generator version
5+
const version = "1.8"; // generator version
66
document.title += " v" + version;
77

88
// switches to disable/enable logging features
@@ -458,15 +458,15 @@ function showWelcomeMessage() {
458458
alertMessage.innerHTML = `The Fantasy Map Generator is updated up to version <strong>${version}</strong>.
459459
This version is compatible with ${changelog}, loaded <i>.map</i> files will be auto-updated.
460460
<ul><strong>Latest changes:</strong>
461+
<li>Submap tool by Goteguru</li>
462+
<li>Resample tool by Goteguru</li>
461463
<li>Pre-defined heightmaps</li>
462464
<li>Advanced notes editor</li>
463465
<li>Zones editor: filter by type</li>
464466
<li>Color picker: new hatchings</li>
465467
<li>New style presets: Cyberpunk and Atlas</li>
466468
<li>Burg temperature graph</li>
467469
<li>4 new textures</li>
468-
<li>Province capture logic rework</li>
469-
<li>Button to release all provinces</li>
470470
</ul>
471471
472472
<p>Join our ${discord} and ${reddit} to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.</p>

modules/submap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ window.Submap = (function () {
308308
if (options.lockMarkers) m.lock = true;
309309
}
310310
}
311-
drawMarkers();
311+
if (layerIsOn("toggleMarkers")) drawMarkers();
312312

313313
stage("Redraw emblems.");
314314
drawEmblems();

modules/ui/options.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -335,27 +335,35 @@ function copyMapURL() {
335335
.catch(err => tip("Could not copy URL: " + err, false, "error", 5000));
336336
}
337337

338-
const cellsDensityConstants = {
339-
1: 1000,
340-
2: 2000,
341-
3: 5000,
342-
4: 10000,
343-
5: 20000,
344-
6: 30000,
345-
7: 40000,
346-
8: 50000,
347-
9: 60000,
348-
10: 70000,
349-
11: 80000,
350-
12: 90000,
351-
13: 100000,
338+
const cellsDensityMap = {
339+
1: 1000,
340+
2: 2000,
341+
3: 5000,
342+
4: 10000,
343+
5: 20000,
344+
6: 30000,
345+
7: 40000,
346+
8: 50000,
347+
9: 60000,
348+
10: 70000,
349+
11: 80000,
350+
12: 90000,
351+
13: 100000
352352
};
353353

354354
function changeCellsDensity(value) {
355-
const cells = value in cellsDensityConstants? cellsDensityConstants[value]: 1000;
355+
const cells = cellsDensityMap[value] || 1000;
356356
pointsInput.dataset.cells = cells;
357-
pointsOutput_formatted.value = cells / 1000 + "K";
358-
pointsOutput_formatted.style.color = cells > 50000 ? "#b12117" : cells !== 10000 ? "#dfdf12" : "#053305";
357+
pointsOutputFormatted.value = getCellsDensityValue(cells);
358+
pointsOutputFormatted.style.color = getCellsDensityColor(cells);
359+
}
360+
361+
function getCellsDensityValue(cells) {
362+
return cells / 1000 + "K";
363+
}
364+
365+
function getCellsDensityColor(cells) {
366+
return cells > 50000 ? "#b12117" : cells !== 10000 ? "#dfdf12" : "#053305";
359367
}
360368

361369
function changeCultureSet() {

0 commit comments

Comments
 (0)