Skip to content

Commit a3fa544

Browse files
author
Azgaar
committed
v1.2.02
1 parent 2ba1332 commit a3fa544

16 files changed

+137
-113
lines changed

index.css

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ button, select, a {
7070

7171
#biomes {
7272
stroke-width: .7;
73+
fill-rule: evenodd;
7374
}
7475

7576
#landmass {
7677
mask: url(#land);
78+
fill-rule: evenodd;
7779
}
7880

7981
#lakes, #coastline {
@@ -86,6 +88,11 @@ button, select, a {
8688
text-anchor: middle;
8789
dominant-baseline: central;
8890
text-shadow: 0px 0px 10px white;
91+
fill-rule: evenodd;
92+
}
93+
94+
#oceanLayers {
95+
fill-rule: evenodd;
8996
}
9097

9198
#coastline {
@@ -99,7 +106,7 @@ button, select, a {
99106

100107
#statesBody, #provincesBody {
101108
stroke-width: 2;
102-
109+
fill-rule: evenodd;
103110
mask: url(#land);
104111
}
105112

@@ -620,14 +627,8 @@ fieldset {
620627
cursor: default;
621628
}
622629

623-
#cellInfo>div {
624-
margin: 3px 0px 3px 3px;
625-
display: inline-block;
626-
vertical-align: top;
627-
}
628-
629-
#cellInfo>div:nth-child(2) {
630-
width: 50%;
630+
#cellInfo {
631+
user-select: text;
631632
}
632633

633634
#tooltip {
@@ -1582,7 +1583,7 @@ div.states > div.biomeArea {
15821583

15831584
#ruler .planimeter {
15841585
fill: lightblue;
1585-
1586+
fill-rule: evenodd;
15861587
fill-opacity: 0.5;
15871588
stroke: #737373;
15881589
}
@@ -1831,8 +1832,9 @@ svg.button {
18311832
#alertMessage {
18321833
-moz-user-select: text;
18331834
user-select: text;
1834-
max-height: 75vh;
1835+
max-height: 70vh;
18351836
max-width: 75vw;
1837+
overflow: auto;
18361838
}
18371839

18381840
#alertMessage ul {

index.html

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@
12491249
<td>Style</td>
12501250
<td>
12511251
<select id="styleReliefSet">
1252-
<option value="simple" selected>Old</option>
1252+
<option value="simple" selected>Simple</option>
12531253
<option value="gray">Gray</option>
12541254
<option value="colored">Colored</option>
12551255
</select>
@@ -1520,21 +1520,21 @@
15201520
<p data-tip="Map generation settings. Generate a new map to apply the settings">Map settings (new map to apply):</p>
15211521
<table>
15221522

1523-
<tr data-tip="Map height and width in pixels. Please consider reducing map size in case of performance issues">
1523+
<tr data-tip="Canvas height and width in pixels, please keep at your screen size or less to improve performance">
15241524
<td></td>
1525-
<td>Map size</td>
1525+
<td>Canvas size</td>
15261526
<td>
15271527
<span data-tip="Map width in pixels">width</span>
15281528
<input data-tip="Map width in pixels" id="mapWidthInput" class="paired" type="number" min=240 value=960>
15291529
<span data-tip="Map height in pixels">height</span>
15301530
<input data-tip="Map height in pixels" id="mapHeightInput" class="paired" type="number" min=135 value=540>
15311531
</td>
15321532
<td>
1533-
<i data-tip="Toggle between screen size and initial map size" id="toggleFullscreen" class="icon-resize-full-alt"></i>
1533+
<i data-tip="Toggle between screen size and initial canvas size" id="toggleFullscreen" class="icon-resize-full-alt"></i>
15341534
</td>
15351535
</tr>
15361536

1537-
<tr data-tip="Map seed number. Seed produces the same map only if map size and options are the same">
1537+
<tr data-tip="Map seed number. Seed produces the same map only if canvas size and options are the same">
15381538
<td>
15391539
<i data-tip="Click to generate a map for this seed" id="optionsSeedGenerate"></i>
15401540
</td>
@@ -1581,7 +1581,7 @@
15811581
<option value="Volcano">Volcano</option>
15821582
<option value="High Island">High Island</option>
15831583
<option value="Low Island">Low Island</option>
1584-
<option value="Continents">Continents</option>
1584+
<option value="Continents">Two Continents</option>
15851585
<option value="Archipelago">Archipelago</option>
15861586
<option value="Atoll">Atoll</option>
15871587
<option value="Mediterranean">Mediterranean</option>
@@ -1692,7 +1692,7 @@
16921692
</td>
16931693
</tr>
16941694

1695-
<tr data-tip="Define how many organized (!) religions and cults should be generated">
1695+
<tr data-tip="Define how many organized religions and cults should be generated. Cultures will have their own folk religions in any case">
16961696
<td>
16971697
<i data-locked=0 id="lock_religions" class="icon-lock-open"></i>
16981698
</td>
@@ -1805,6 +1805,7 @@
18051805
<div>
18061806
<p>Click to overview:</p>
18071807
<button id="overviewBurgsButton" data-tip="Click to open Burgs Overview. Shortcut: Shift + T">Burgs</button>
1808+
<button id="overviewCellsButton" data-tip="Click to open Cell details view. Shortcut: Shift + E">Cells</button>
18081809
<!-- <button id="overviewLandmassedButton" data-tip="Click to open Landmasses Overview. Shortcut: Shift + L">Landmasses</button> -->
18091810
<!-- <button id="overviewWaterbodiesButton" data-tip="Click to open Waterbodies Overview. Shortcut: Shift + W">Waterbodies</button> -->
18101811
<!-- <button id="overviewRiversButton" data-tip="Click to open Rivers Overview. Shortcut: Shift + V">Rivers</button> -->
@@ -1834,30 +1835,6 @@
18341835
<button id="addRoute" data-tip="Click on map to place a route. Shortcut: Shift + E">Route</button>
18351836
<button id="addMarker" data-tip="Click on map to place a marker. Hold Shift to add multiple. Shortcut: Shift + K">Marker</button>
18361837
</div>
1837-
1838-
<p>Cell info: <i data-tip="Click to toggle the section" class="collapsible icon-down-open pointer"></i></p>
1839-
<div id="cellInfo" style="display: none">
1840-
<div>
1841-
Coord: <span id="infoX">0</span>/<span id="infoY">0</span><br>
1842-
Cell: <span id="infoCell">0</span><br>
1843-
Area: <span id="infoArea">0</span><br>
1844-
</div>
1845-
<div>
1846-
Type: <span id="infoFeature">n/a</span><br>
1847-
Precip: <span id="infoPrec">0</span><br>
1848-
Population: <span id="infoPopulation">0</span>
1849-
</div>
1850-
<div>
1851-
Height: <span id="infoHeight">0</span><br>
1852-
Temperature: <span id="infoTemp">0</span><br>
1853-
Biome: <span id="infoBiome">n/a</span><br>
1854-
State: <span id="infoState">n/a</span><br>
1855-
Province: <span id="infoProvince">n/a</span><br>
1856-
Culture: <span id="infoCulture">n/a</span><br>
1857-
Religion: <span id="infoReligion">n/a</span><br>
1858-
Burg: <span id="infoBurg">n/a</span>
1859-
</div>
1860-
</div>
18611838
</div>
18621839

18631840
<div id="customizationMenu" class="tabcontent">
@@ -1995,8 +1972,8 @@
19951972
<input id="precOutput" data-stored="prec" type="range" min="0" max="500" value="50">
19961973
</label>
19971974
</div>
1998-
<div data-tip="Map size. Can be changed in general options">
1999-
<i>Map size:</i><br>
1975+
<div data-tip="Canvas size. Can be changed in general options on new map generation">
1976+
<i>Canvas size:</i><br>
20001977
<span id="mapSize"></span> px = <span id="mapSizeFriendly"></span>
20011978
</div>
20021979
<div>
@@ -2503,7 +2480,7 @@
25032480
<option value="templateVolcano">Volcano</option>
25042481
<option value="templateHighIsland">High Island</option>
25052482
<option value="templateLowIsland">Low Island</option>
2506-
<option value="templateContinents">Continents</option>
2483+
<option value="templateContinents">Two Continents</option>
25072484
<option value="templateArchipelago">Archipelago</option>
25082485
<option value="templateAtoll">Atoll</option>
25092486
<option value="templateMediterranean">Mediterranean</option>
@@ -3238,6 +3215,23 @@
32383215
</div>
32393216
</div>
32403217

3218+
<div id="cellInfo" style="display: none" class="dialog stable">
3219+
<p><b>Cell:</b> <span id="infoCell">0</span></p>
3220+
<p><b>Coord:</b> <span id="infoX">0</span>/<span id="infoY">0</span></p>
3221+
<p><b>Area:</b> <span id="infoArea">0</span></p>
3222+
<p><b>Type:</b> <span id="infoFeature">n/a</span></p>
3223+
<p><b>Precipitation:</b> <span id="infoPrec">0</span></p>
3224+
<p><b>Population:</b> <span id="infoPopulation">0</span></p>
3225+
<p><b>Height:</b> <span id="infoHeight">0</span></p>
3226+
<p><b>Temperature:</b> <span id="infoTemp">0</span></p>
3227+
<p><b>Biome:</b> <span id="infoBiome">n/a</span></p>
3228+
<p><b>State:</b> <span id="infoState">n/a</span></p>
3229+
<p><b>Province:</b> <span id="infoProvince">n/a</span></p>
3230+
<p><b>Culture:</b> <span id="infoCulture">n/a</span></p>
3231+
<p><b>Religion:</b> <span id="infoReligion">n/a</span></p>
3232+
<p><b>Burg:</b> <span id="infoBurg">n/a</span></p>
3233+
</div>
3234+
32413235
<div id="preview3d" class="dialog stable" style="display: none; padding: 0px"></div>
32423236

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

modules/relief-icons.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
(global.ReliefIcons = factory());
55
}(this, (function () {'use strict';
66

7-
var ReliefIcons = function ReliefIcons() {
7+
const ReliefIcons = function() {
88
console.time('drawRelief');
99
terrain.selectAll("*").remove();
10-
const density = +styleReliefDensityInput.value;
11-
if (!density) return;
12-
13-
const size = 1.6, mod = .2 * size; // size modifier;s
10+
const density = terrain.attr("density") || .4;
11+
const size = 1.6 * (terrain.attr("size") || 1);
12+
const mod = .2 * size; // size modifier;s
1413
const relief = []; // t: type, c: cell, x: centerX, y: centerY, s: size;
1514
const cells = pack.cells;
1615

@@ -106,9 +105,10 @@
106105
}
107106

108107
function getIcon(type) {
109-
if (styleReliefSet.value === "simple") return "#relief-" + getOldIcon(type) + "-1";
110-
if (styleReliefSet.value === "colored") return "#relief-" + type + "-" + getVariant(type);
111-
if (styleReliefSet.value === "gray") return "#relief-" + type + "-" + getVariant(type) + "-bw";
108+
const set = terrain.attr("set") || "simple";
109+
if (set === "simple") return "#relief-" + getOldIcon(type) + "-1";
110+
if (set === "colored") return "#relief-" + type + "-" + getVariant(type);
111+
if (set === "gray") return "#relief-" + type + "-" + getVariant(type) + "-bw";
112112
return "#relief-" + getOldIcon(type) + "-1"; // simple
113113
}
114114

modules/save-and-load.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async function saveJPEG() {
7474
}
7575

7676
// parse map svg to object url
77-
async function getMapURL(type) {
77+
async function getMapURL(type, subtype) {
7878
const cloneEl = document.getElementById("map").cloneNode(true); // clone svg
7979
cloneEl.id = "fantasyMap";
8080
document.body.appendChild(cloneEl);
@@ -83,6 +83,7 @@ async function getMapURL(type) {
8383

8484
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
8585
if (isFirefox && type === "mesh") clone.select("#oceanPattern").remove();
86+
if (subtype === "globe") clone.select("#scaleBar").remove();
8687
if (type === "mesh") clone.attr("width", graphWidth).attr("height", graphHeight);
8788
if (type !== "png") clone.select("#viewbox").attr("transform", null); // reset transform to show whole map
8889
if (type === "svg") removeUnusedElements(clone);
@@ -551,7 +552,7 @@ function uploadMap(file, callback) {
551552
function parseLoadedData(data) {
552553
try {
553554
// exit customization
554-
closeDialogs();
555+
if (window.closeDialogs) closeDialogs();
555556
customization = 0;
556557
if (customizationMenu.offsetParent) styleTab.click();
557558

@@ -908,12 +909,18 @@ function parseLoadedData(data) {
908909

909910
// v 1.11 had an issue with fogging being displayed on load
910911
unfog();
912+
913+
// v 1.2 added new terrain attributes
914+
if (!terrain.attr("set")) terrain.attr("set", "simple");
915+
if (!terrain.attr("size")) terrain.attr("size", 1);
916+
if (!terrain.attr("density")) terrain.attr("density", .4);
911917
}
912918

913919
}()
914920

915921
changeMapSize();
916922
if (window.restoreDefaultEvents) restoreDefaultEvents();
923+
focusOn(); // based on searchParams focus on point, cell or burg
917924
invokeActiveZooming();
918925

919926
console.warn(`TOTAL: ${rn((performance.now()-uploadMap.timeStart)/1000,2)}s`);

modules/ui/3d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ async function startGlobe(canvas) {
190190
// create globe mesh just from svg
191191
async function addGlobe3dMesh() {
192192
threeD.material = new THREE.MeshLambertMaterial();
193-
const url = await getMapURL("mesh");
193+
const url = await getMapURL("mesh", "globe");
194194
threeD.material.map = new THREE.TextureLoader().load(url, render);
195195
threeD.mesh = new THREE.Mesh(new THREE.SphereBufferGeometry(1, 64, 64), threeD.material);
196196
threeD.scene.add(threeD.mesh);

modules/ui/cultures-editor.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ function editCultures() {
304304
pack.cells.culture.forEach((c, i) => {if(c === culture) pack.cells.culture[i] = 0;});
305305
pack.cultures[culture].removed = true;
306306

307+
const origin = pack.cultures[culture].origin;
308+
pack.cultures.forEach(c => {if(c.origin === culture) c.origin = origin;});
309+
307310
refreshCulturesEditor();
308311
}
309312

@@ -363,6 +366,7 @@ function editCultures() {
363366
// build hierarchy tree
364367
pack.cultures[0].origin = null;
365368
const cultures = pack.cultures.filter(c => !c.removed);
369+
if (cultures.length < 3) {tip("Not enough cultures to show hierarchy", false, "error"); return;}
366370
const root = d3.stratify().id(d => d.i).parentId(d => d.origin)(cultures);
367371
const treeWidth = root.leaves().length;
368372
const treeHeight = root.height;
@@ -452,7 +456,6 @@ function editCultures() {
452456
}
453457
}
454458

455-
// re-calculate cultures
456459
function recalculateCultures(must) {
457460
if (!must && !culturesAutoChange.checked) return;
458461

@@ -508,7 +511,7 @@ function editCultures() {
508511
body.querySelector("div.selected").classList.remove("selected");
509512
body.querySelector("div[data-id='"+culture+"']").classList.add("selected");
510513
}
511-
514+
512515
function dragCultureBrush() {
513516
const r = +culturesManuallyBrush.value;
514517

@@ -523,7 +526,6 @@ function editCultures() {
523526
});
524527
}
525528

526-
// change culture within selection
527529
function changeCultureForSelection(selection) {
528530
const temp = cults.select("#temp");
529531
const selected = body.querySelector("div.selected");
@@ -564,7 +566,7 @@ function editCultures() {
564566
}
565567
exitCulturesManualAssignment();
566568
}
567-
569+
568570
function exitCulturesManualAssignment(close) {
569571
customization = 0;
570572
cults.select("#temp").remove();
@@ -637,7 +639,7 @@ function editCultures() {
637639
const name = getFileName("Cultures") + ".csv";
638640
downloadFile(data, name);
639641
}
640-
642+
641643
function closeCulturesEditor() {
642644
debug.select("#cultureCenters").remove();
643645
exitCulturesManualAssignment("close");

modules/ui/editors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function drawLegend(name, data) {
262262
fitLegendBox();
263263
}
264264

265-
// fit Legend box to map size
265+
// fit Legend box to canvas size
266266
function fitLegendBox() {
267267
if (!legend.selectAll("*").size()) return;
268268
const px = isNaN(+legend.attr("data-x")) ? 99 : legend.attr("data-x") / 100;

modules/ui/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function moved() {
5050
showNotes(d3.event, i);
5151
const g = findGridCell(point[0], point[1]); // grid cell id
5252
if (tooltip.dataset.main) showMainTip(); else showMapTooltip(point, d3.event, i, g);
53-
if (toolsContent.style.display === "block" && cellInfo.style.display === "block") updateCellInfo(point, i, g);
53+
if (cellInfo.offsetParent) updateCellInfo(point, i, g);
5454
}
5555

5656
// show note box on hover (if any)

0 commit comments

Comments
 (0)