mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-06 18:41:24 +01:00
feat: separate labels rendering from generation process
This commit is contained in:
parent
c76a737f94
commit
3925a38de0
15 changed files with 169 additions and 146 deletions
|
|
@ -721,7 +721,7 @@ input[type="color"]::-webkit-color-swatch-wrapper {
|
||||||
|
|
||||||
#toolsContent > .grid {
|
#toolsContent > .grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
margin: 0.2em 0;
|
margin: 0.2em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
index.html
10
index.html
|
|
@ -652,10 +652,10 @@
|
||||||
<u>L</u>abels
|
<u>L</u>abels
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
id="toggleIcons"
|
id="toggleBurgIcons"
|
||||||
data-tip="Burg icons: click to toggle, drag to raise or lower the layer. Ctrl + click to edit layer style"
|
data-tip="Burg icons: click to toggle, drag to raise or lower the layer. Ctrl + click to edit layer style"
|
||||||
data-shortcut="I"
|
data-shortcut="I"
|
||||||
onclick="toggleIcons(event)"
|
onclick="toggleBurgIcons(event)"
|
||||||
>
|
>
|
||||||
<u>I</u>cons
|
<u>I</u>cons
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -2063,7 +2063,7 @@
|
||||||
id="regenerateStateLabels"
|
id="regenerateStateLabels"
|
||||||
data-tip="Click to update state labels placement based on current borders"
|
data-tip="Click to update state labels placement based on current borders"
|
||||||
>
|
>
|
||||||
Labels
|
State Labels
|
||||||
</button>
|
</button>
|
||||||
<button id="regenerateMarkers" data-tip="Click to regenerate unlocked markers">
|
<button id="regenerateMarkers" data-tip="Click to regenerate unlocked markers">
|
||||||
Markers <i id="configRegenerateMarkers" class="icon-cog" data-tip="Click to set number multiplier"></i>
|
Markers <i id="configRegenerateMarkers" class="icon-cog" data-tip="Click to set number multiplier"></i>
|
||||||
|
|
@ -8010,7 +8010,6 @@
|
||||||
<script src="modules/biomes.js?v=1.99.00"></script>
|
<script src="modules/biomes.js?v=1.99.00"></script>
|
||||||
<script src="modules/names-generator.js?v=1.87.14"></script>
|
<script src="modules/names-generator.js?v=1.87.14"></script>
|
||||||
<script src="modules/cultures-generator.js?v=1.99.05"></script>
|
<script src="modules/cultures-generator.js?v=1.99.05"></script>
|
||||||
<script src="modules/renderers/draw-state-labels.js?v=1.104.0"></script>
|
|
||||||
<script src="modules/burgs-and-states.js?v=1.104.0"></script>
|
<script src="modules/burgs-and-states.js?v=1.104.0"></script>
|
||||||
<script src="modules/provinces-generator.js?v=1.104.0"></script>
|
<script src="modules/provinces-generator.js?v=1.104.0"></script>
|
||||||
<script src="modules/routes-generator.js?v=1.99.04"></script>
|
<script src="modules/routes-generator.js?v=1.99.04"></script>
|
||||||
|
|
@ -8089,5 +8088,8 @@
|
||||||
<script defer src="modules/renderers/draw-temperature.js?v=1.104.0"></script>
|
<script defer src="modules/renderers/draw-temperature.js?v=1.104.0"></script>
|
||||||
<script defer src="modules/renderers/draw-emblems.js?v=1.104.0"></script>
|
<script defer src="modules/renderers/draw-emblems.js?v=1.104.0"></script>
|
||||||
<script defer src="modules/renderers/draw-military.js?v=1.104.0"></script>
|
<script defer src="modules/renderers/draw-military.js?v=1.104.0"></script>
|
||||||
|
<script defer src="modules/renderers/draw-state-labels.js?v=1.104.0"></script>
|
||||||
|
<script defer src="modules/renderers/draw-burg-labels.js?v=1.104.0"></script>
|
||||||
|
<script defer src="modules/renderers/draw-burg-icons.js?v=1.104.0"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
2
main.js
2
main.js
|
|
@ -655,8 +655,6 @@ async function generate(options) {
|
||||||
Provinces.getPoles();
|
Provinces.getPoles();
|
||||||
BurgsAndStates.defineBurgFeatures();
|
BurgsAndStates.defineBurgFeatures();
|
||||||
|
|
||||||
drawStateLabels();
|
|
||||||
|
|
||||||
Rivers.specify();
|
Rivers.specify();
|
||||||
Features.specify();
|
Features.specify();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ window.BurgsAndStates = (() => {
|
||||||
|
|
||||||
generateCampaigns();
|
generateCampaigns();
|
||||||
generateDiplomacy();
|
generateDiplomacy();
|
||||||
drawBurgs();
|
|
||||||
|
|
||||||
function placeCapitals() {
|
function placeCapitals() {
|
||||||
TIME && console.time("placeCapitals");
|
TIME && console.time("placeCapitals");
|
||||||
|
|
@ -274,103 +273,6 @@ window.BurgsAndStates = (() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const drawBurgs = () => {
|
|
||||||
TIME && console.time("drawBurgs");
|
|
||||||
|
|
||||||
// remove old data
|
|
||||||
burgIcons.selectAll("circle").remove();
|
|
||||||
burgLabels.selectAll("text").remove();
|
|
||||||
icons.selectAll("use").remove();
|
|
||||||
|
|
||||||
// capitals
|
|
||||||
const capitals = pack.burgs.filter(b => b.capital && !b.removed);
|
|
||||||
const capitalIcons = burgIcons.select("#cities");
|
|
||||||
const capitalLabels = burgLabels.select("#cities");
|
|
||||||
const capitalSize = capitalIcons.attr("size") || 1;
|
|
||||||
const capitalAnchors = anchors.selectAll("#cities");
|
|
||||||
const caSize = capitalAnchors.attr("size") || 2;
|
|
||||||
|
|
||||||
capitalIcons
|
|
||||||
.selectAll("circle")
|
|
||||||
.data(capitals)
|
|
||||||
.enter()
|
|
||||||
.append("circle")
|
|
||||||
.attr("id", d => "burg" + d.i)
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("cx", d => d.x)
|
|
||||||
.attr("cy", d => d.y)
|
|
||||||
.attr("r", capitalSize);
|
|
||||||
|
|
||||||
capitalLabels
|
|
||||||
.selectAll("text")
|
|
||||||
.data(capitals)
|
|
||||||
.enter()
|
|
||||||
.append("text")
|
|
||||||
.attr("id", d => "burgLabel" + d.i)
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("x", d => d.x)
|
|
||||||
.attr("y", d => d.y)
|
|
||||||
.attr("dy", `${capitalSize * -1.5}px`)
|
|
||||||
.text(d => d.name);
|
|
||||||
|
|
||||||
capitalAnchors
|
|
||||||
.selectAll("use")
|
|
||||||
.data(capitals.filter(c => c.port))
|
|
||||||
.enter()
|
|
||||||
.append("use")
|
|
||||||
.attr("xlink:href", "#icon-anchor")
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("x", d => rn(d.x - caSize * 0.47, 2))
|
|
||||||
.attr("y", d => rn(d.y - caSize * 0.47, 2))
|
|
||||||
.attr("width", caSize)
|
|
||||||
.attr("height", caSize);
|
|
||||||
|
|
||||||
// towns
|
|
||||||
const towns = pack.burgs.filter(b => b.i && !b.capital && !b.removed);
|
|
||||||
const townIcons = burgIcons.select("#towns");
|
|
||||||
const townLabels = burgLabels.select("#towns");
|
|
||||||
const townSize = townIcons.attr("size") || 0.5;
|
|
||||||
const townsAnchors = anchors.selectAll("#towns");
|
|
||||||
const taSize = townsAnchors.attr("size") || 1;
|
|
||||||
|
|
||||||
townIcons
|
|
||||||
.selectAll("circle")
|
|
||||||
.data(towns)
|
|
||||||
.enter()
|
|
||||||
.append("circle")
|
|
||||||
.attr("id", d => "burg" + d.i)
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("cx", d => d.x)
|
|
||||||
.attr("cy", d => d.y)
|
|
||||||
.attr("r", townSize);
|
|
||||||
|
|
||||||
townLabels
|
|
||||||
.selectAll("text")
|
|
||||||
.data(towns)
|
|
||||||
.enter()
|
|
||||||
.append("text")
|
|
||||||
.attr("id", d => "burgLabel" + d.i)
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("x", d => d.x)
|
|
||||||
.attr("y", d => d.y)
|
|
||||||
.attr("dy", `${townSize * -1.5}px`)
|
|
||||||
.text(d => d.name);
|
|
||||||
|
|
||||||
townsAnchors
|
|
||||||
.selectAll("use")
|
|
||||||
.data(towns.filter(c => c.port))
|
|
||||||
.enter()
|
|
||||||
.append("use")
|
|
||||||
.attr("xlink:href", "#icon-anchor")
|
|
||||||
.attr("data-id", d => d.i)
|
|
||||||
.attr("x", d => rn(d.x - taSize * 0.47, 2))
|
|
||||||
.attr("y", d => rn(d.y - taSize * 0.47, 2))
|
|
||||||
.attr("width", taSize)
|
|
||||||
.attr("height", taSize);
|
|
||||||
|
|
||||||
TIME && console.timeEnd("drawBurgs");
|
|
||||||
};
|
|
||||||
|
|
||||||
// expand cultures across the map (Dijkstra-like algorithm)
|
// expand cultures across the map (Dijkstra-like algorithm)
|
||||||
const expandStates = () => {
|
const expandStates = () => {
|
||||||
TIME && console.time("expandStates");
|
TIME && console.time("expandStates");
|
||||||
|
|
@ -960,7 +862,6 @@ window.BurgsAndStates = (() => {
|
||||||
normalizeStates,
|
normalizeStates,
|
||||||
getPoles,
|
getPoles,
|
||||||
assignColors,
|
assignColors,
|
||||||
drawBurgs,
|
|
||||||
specifyBurgs,
|
specifyBurgs,
|
||||||
defineBurgFeatures,
|
defineBurgFeatures,
|
||||||
getType,
|
getType,
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ async function parseLoadedData(data, mapVersion) {
|
||||||
if (hasChild(prec, "circle")) turnOn("togglePrecipitation");
|
if (hasChild(prec, "circle")) turnOn("togglePrecipitation");
|
||||||
if (isVisible(emblems) && hasChild(emblems, "use")) turnOn("toggleEmblems");
|
if (isVisible(emblems) && hasChild(emblems, "use")) turnOn("toggleEmblems");
|
||||||
if (isVisible(labels)) turnOn("toggleLabels");
|
if (isVisible(labels)) turnOn("toggleLabels");
|
||||||
if (isVisible(icons)) turnOn("toggleIcons");
|
if (isVisible(icons)) turnOn("toggleBurgIcons");
|
||||||
if (hasChildren(armies) && isVisible(armies)) turnOn("toggleMilitary");
|
if (hasChildren(armies) && isVisible(armies)) turnOn("toggleMilitary");
|
||||||
if (hasChildren(markers)) turnOn("toggleMarkers");
|
if (hasChildren(markers)) turnOn("toggleMarkers");
|
||||||
if (isVisible(ruler)) turnOn("toggleRulers");
|
if (isVisible(ruler)) turnOn("toggleRulers");
|
||||||
|
|
|
||||||
67
modules/renderers/draw-burg-icons.js
Normal file
67
modules/renderers/draw-burg-icons.js
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function drawBurgIcons() {
|
||||||
|
TIME && console.time("drawBurgIcons");
|
||||||
|
|
||||||
|
// capitals
|
||||||
|
const capitals = pack.burgs.filter(b => b.capital && !b.removed);
|
||||||
|
const capitalIcons = burgIcons.select("#cities");
|
||||||
|
const capitalSize = capitalIcons.attr("size") || 1;
|
||||||
|
const capitalAnchors = anchors.selectAll("#cities");
|
||||||
|
const capitalAnchorsSize = capitalAnchors.attr("size") || 2;
|
||||||
|
|
||||||
|
capitalIcons
|
||||||
|
.selectAll("circle")
|
||||||
|
.data(capitals)
|
||||||
|
.enter()
|
||||||
|
.append("circle")
|
||||||
|
.attr("id", d => "burg" + d.i)
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("cx", d => d.x)
|
||||||
|
.attr("cy", d => d.y)
|
||||||
|
.attr("r", capitalSize);
|
||||||
|
|
||||||
|
capitalAnchors
|
||||||
|
.selectAll("use")
|
||||||
|
.data(capitals.filter(c => c.port))
|
||||||
|
.enter()
|
||||||
|
.append("use")
|
||||||
|
.attr("xlink:href", "#icon-anchor")
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("x", d => rn(d.x - capitalAnchorsSize * 0.47, 2))
|
||||||
|
.attr("y", d => rn(d.y - capitalAnchorsSize * 0.47, 2))
|
||||||
|
.attr("width", capitalAnchorsSize)
|
||||||
|
.attr("height", capitalAnchorsSize);
|
||||||
|
|
||||||
|
// towns
|
||||||
|
const towns = pack.burgs.filter(b => b.i && !b.capital && !b.removed);
|
||||||
|
const townIcons = burgIcons.select("#towns");
|
||||||
|
const townSize = townIcons.attr("size") || 0.5;
|
||||||
|
const townsAnchors = anchors.selectAll("#towns");
|
||||||
|
const townsAnchorsSize = townsAnchors.attr("size") || 1;
|
||||||
|
|
||||||
|
townIcons
|
||||||
|
.selectAll("circle")
|
||||||
|
.data(towns)
|
||||||
|
.enter()
|
||||||
|
.append("circle")
|
||||||
|
.attr("id", d => "burg" + d.i)
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("cx", d => d.x)
|
||||||
|
.attr("cy", d => d.y)
|
||||||
|
.attr("r", townSize);
|
||||||
|
|
||||||
|
townsAnchors
|
||||||
|
.selectAll("use")
|
||||||
|
.data(towns.filter(c => c.port))
|
||||||
|
.enter()
|
||||||
|
.append("use")
|
||||||
|
.attr("xlink:href", "#icon-anchor")
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("x", d => rn(d.x - townsAnchorsSize * 0.47, 2))
|
||||||
|
.attr("y", d => rn(d.y - townsAnchorsSize * 0.47, 2))
|
||||||
|
.attr("width", townsAnchorsSize)
|
||||||
|
.attr("height", townsAnchorsSize);
|
||||||
|
|
||||||
|
TIME && console.timeEnd("drawBurgIcons");
|
||||||
|
}
|
||||||
37
modules/renderers/draw-burg-labels.js
Normal file
37
modules/renderers/draw-burg-labels.js
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function drawBurgLabels() {
|
||||||
|
TIME && console.time("drawBurgLabels");
|
||||||
|
|
||||||
|
const capitals = pack.burgs.filter(b => b.capital && !b.removed);
|
||||||
|
const capitalSize = burgIcons.select("#cities").attr("size") || 1;
|
||||||
|
burgLabels
|
||||||
|
.select("#cities")
|
||||||
|
.selectAll("text")
|
||||||
|
.data(capitals)
|
||||||
|
.enter()
|
||||||
|
.append("text")
|
||||||
|
.attr("id", d => "burgLabel" + d.i)
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("x", d => d.x)
|
||||||
|
.attr("y", d => d.y)
|
||||||
|
.attr("dy", `${capitalSize * -1.5}px`)
|
||||||
|
.text(d => d.name);
|
||||||
|
|
||||||
|
const towns = pack.burgs.filter(b => b.i && !b.capital && !b.removed);
|
||||||
|
const townSize = burgIcons.select("#towns").attr("size") || 0.5;
|
||||||
|
burgLabels
|
||||||
|
.select("#towns")
|
||||||
|
.selectAll("text")
|
||||||
|
.data(towns)
|
||||||
|
.enter()
|
||||||
|
.append("text")
|
||||||
|
.attr("id", d => "burgLabel" + d.i)
|
||||||
|
.attr("data-id", d => d.i)
|
||||||
|
.attr("x", d => d.x)
|
||||||
|
.attr("y", d => d.y)
|
||||||
|
.attr("dy", `${townSize * -2}px`)
|
||||||
|
.text(d => d.name);
|
||||||
|
|
||||||
|
TIME && console.timeEnd("drawBurgLabels");
|
||||||
|
}
|
||||||
|
|
@ -260,8 +260,6 @@ window.Submap = (function () {
|
||||||
p.center = newCenters.length ? newCenters[0] : pack.cells.province.findIndex(x => x === i);
|
p.center = newCenters.length ? newCenters[0] : pack.cells.province.findIndex(x => x === i);
|
||||||
});
|
});
|
||||||
|
|
||||||
BurgsAndStates.drawBurgs();
|
|
||||||
|
|
||||||
stage("Regenerating routes network");
|
stage("Regenerating routes network");
|
||||||
regenerateRoutes();
|
regenerateRoutes();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ window.ThreeD = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// icons
|
// icons
|
||||||
if (layerIsOn("toggleIcons")) {
|
if (layerIsOn("toggleBurgIcons")) {
|
||||||
const geometry = isCity ? city_icon_geometry : town_icon_geometry;
|
const geometry = isCity ? city_icon_geometry : town_icon_geometry;
|
||||||
const material = isCity ? city_icon_material : town_icon_material;
|
const material = isCity ? city_icon_material : town_icon_material;
|
||||||
const iconMesh = new THREE.Mesh(geometry, material);
|
const iconMesh = new THREE.Mesh(geometry, material);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
function editBurg(id) {
|
function editBurg(id) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
closeDialogs(".stable");
|
closeDialogs(".stable");
|
||||||
if (!layerIsOn("toggleIcons")) toggleIcons();
|
if (!layerIsOn("toggleBurgIcons")) toggleBurgIcons();
|
||||||
if (!layerIsOn("toggleLabels")) toggleLabels();
|
if (!layerIsOn("toggleLabels")) toggleLabels();
|
||||||
|
|
||||||
const burg = id || d3.event.target.dataset.id;
|
const burg = id || d3.event.target.dataset.id;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
closeDialogs("#burgsOverview, .stable");
|
closeDialogs("#burgsOverview, .stable");
|
||||||
if (!layerIsOn("toggleIcons")) toggleIcons();
|
if (!layerIsOn("toggleBurgIcons")) toggleBurgIcons();
|
||||||
if (!layerIsOn("toggleLabels")) toggleLabels();
|
if (!layerIsOn("toggleLabels")) toggleLabels();
|
||||||
|
|
||||||
const body = byId("burgsBody");
|
const body = byId("burgsBody");
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ function handleKeyup(event) {
|
||||||
else if (code === "KeyA") togglePrecipitation();
|
else if (code === "KeyA") togglePrecipitation();
|
||||||
else if (code === "KeyY") toggleEmblems();
|
else if (code === "KeyY") toggleEmblems();
|
||||||
else if (code === "KeyL") toggleLabels();
|
else if (code === "KeyL") toggleLabels();
|
||||||
else if (code === "KeyI") toggleIcons();
|
else if (code === "KeyI") toggleBurgIcons();
|
||||||
else if (code === "KeyM") toggleMilitary();
|
else if (code === "KeyM") toggleMilitary();
|
||||||
else if (code === "KeyK") toggleMarkers();
|
else if (code === "KeyK") toggleMarkers();
|
||||||
else if (code === "Equal" && !customization) toggleRulers();
|
else if (code === "Equal" && !customization) toggleRulers();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function getDefaultPresets() {
|
||||||
return {
|
return {
|
||||||
political: [
|
political: [
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleIce",
|
"toggleIce",
|
||||||
"toggleLabels",
|
"toggleLabels",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
|
|
@ -20,7 +20,7 @@ function getDefaultPresets() {
|
||||||
cultural: [
|
cultural: [
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleCultures",
|
"toggleCultures",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleLabels",
|
"toggleLabels",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
"toggleRoutes",
|
"toggleRoutes",
|
||||||
|
|
@ -29,7 +29,7 @@ function getDefaultPresets() {
|
||||||
],
|
],
|
||||||
religions: [
|
religions: [
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleLabels",
|
"toggleLabels",
|
||||||
"toggleReligions",
|
"toggleReligions",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
|
|
@ -37,7 +37,14 @@ function getDefaultPresets() {
|
||||||
"toggleScaleBar",
|
"toggleScaleBar",
|
||||||
"toggleVignette"
|
"toggleVignette"
|
||||||
],
|
],
|
||||||
provinces: ["toggleBorders", "toggleIcons", "toggleProvinces", "toggleRivers", "toggleScaleBar", "toggleVignette"],
|
provinces: [
|
||||||
|
"toggleBorders",
|
||||||
|
"toggleBurgIcons",
|
||||||
|
"toggleProvinces",
|
||||||
|
"toggleRivers",
|
||||||
|
"toggleScaleBar",
|
||||||
|
"toggleVignette"
|
||||||
|
],
|
||||||
biomes: ["toggleBiomes", "toggleIce", "toggleRivers", "toggleScaleBar", "toggleVignette"],
|
biomes: ["toggleBiomes", "toggleIce", "toggleRivers", "toggleScaleBar", "toggleVignette"],
|
||||||
heightmap: ["toggleHeight", "toggleRivers", "toggleVignette"],
|
heightmap: ["toggleHeight", "toggleRivers", "toggleVignette"],
|
||||||
physical: ["toggleCoordinates", "toggleHeight", "toggleIce", "toggleRivers", "toggleScaleBar", "toggleVignette"],
|
physical: ["toggleCoordinates", "toggleHeight", "toggleIce", "toggleRivers", "toggleScaleBar", "toggleVignette"],
|
||||||
|
|
@ -45,7 +52,7 @@ function getDefaultPresets() {
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleHeight",
|
"toggleHeight",
|
||||||
"toggleIce",
|
"toggleIce",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleMarkers",
|
"toggleMarkers",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
"toggleRoutes",
|
"toggleRoutes",
|
||||||
|
|
@ -54,7 +61,7 @@ function getDefaultPresets() {
|
||||||
],
|
],
|
||||||
military: [
|
military: [
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleLabels",
|
"toggleLabels",
|
||||||
"toggleMilitary",
|
"toggleMilitary",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
|
|
@ -65,7 +72,7 @@ function getDefaultPresets() {
|
||||||
],
|
],
|
||||||
emblems: [
|
emblems: [
|
||||||
"toggleBorders",
|
"toggleBorders",
|
||||||
"toggleIcons",
|
"toggleBurgIcons",
|
||||||
"toggleIce",
|
"toggleIce",
|
||||||
"toggleEmblems",
|
"toggleEmblems",
|
||||||
"toggleRivers",
|
"toggleRivers",
|
||||||
|
|
@ -161,28 +168,32 @@ function drawLayers() {
|
||||||
drawFeatures();
|
drawFeatures();
|
||||||
if (layerIsOn("toggleTexture")) drawTexture();
|
if (layerIsOn("toggleTexture")) drawTexture();
|
||||||
if (layerIsOn("toggleHeight")) drawHeightmap();
|
if (layerIsOn("toggleHeight")) drawHeightmap();
|
||||||
|
if (layerIsOn("toggleBiomes")) drawBiomes();
|
||||||
if (layerIsOn("toggleCells")) drawCells();
|
if (layerIsOn("toggleCells")) drawCells();
|
||||||
if (layerIsOn("toggleGrid")) drawGrid();
|
if (layerIsOn("toggleGrid")) drawGrid();
|
||||||
if (layerIsOn("toggleCoordinates")) drawCoordinates();
|
if (layerIsOn("toggleCoordinates")) drawCoordinates();
|
||||||
if (layerIsOn("toggleCompass")) compass.style("display", "block");
|
if (layerIsOn("toggleCompass")) compass.style("display", "block");
|
||||||
if (layerIsOn("toggleRoutes")) drawRoutes();
|
if (layerIsOn("toggleRivers")) drawRivers();
|
||||||
if (layerIsOn("toggleTemperature")) drawTemperature();
|
|
||||||
if (layerIsOn("togglePrecipitation")) drawPrecipitation();
|
|
||||||
if (layerIsOn("togglePopulation")) drawPopulation();
|
|
||||||
if (layerIsOn("toggleBiomes")) drawBiomes();
|
|
||||||
if (layerIsOn("toggleRelief")) ReliefIcons.draw();
|
if (layerIsOn("toggleRelief")) ReliefIcons.draw();
|
||||||
if (layerIsOn("toggleCultures")) drawCultures();
|
|
||||||
if (layerIsOn("toggleProvinces")) drawProvinces();
|
|
||||||
if (layerIsOn("toggleReligions")) drawReligions();
|
if (layerIsOn("toggleReligions")) drawReligions();
|
||||||
if (layerIsOn("toggleIce")) drawIce();
|
if (layerIsOn("toggleCultures")) drawCultures();
|
||||||
if (layerIsOn("toggleEmblems")) drawEmblems();
|
if (layerIsOn("toggleStates")) drawStates();
|
||||||
if (layerIsOn("toggleMarkers")) drawMarkers();
|
if (layerIsOn("toggleProvinces")) drawProvinces();
|
||||||
if (layerIsOn("toggleZones")) drawZones();
|
if (layerIsOn("toggleZones")) drawZones();
|
||||||
if (layerIsOn("toggleBorders")) drawBorders();
|
if (layerIsOn("toggleBorders")) drawBorders();
|
||||||
if (layerIsOn("toggleStates")) drawStates();
|
if (layerIsOn("toggleRoutes")) drawRoutes();
|
||||||
if (layerIsOn("toggleRivers")) drawRivers();
|
if (layerIsOn("toggleTemperature")) drawTemperature();
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
|
if (layerIsOn("toggleIce")) drawIce();
|
||||||
|
if (layerIsOn("togglePrecipitation")) drawPrecipitation();
|
||||||
|
if (layerIsOn("toggleEmblems")) drawEmblems();
|
||||||
|
if (layerIsOn("toggleLabels")) drawLabels();
|
||||||
|
if (layerIsOn("toggleBurgIcons")) drawBurgIcons();
|
||||||
if (layerIsOn("toggleMilitary")) drawMilitary();
|
if (layerIsOn("toggleMilitary")) drawMilitary();
|
||||||
|
if (layerIsOn("toggleMarkers")) drawMarkers();
|
||||||
if (layerIsOn("toggleRulers")) rulers.draw();
|
if (layerIsOn("toggleRulers")) rulers.draw();
|
||||||
|
// scale bar
|
||||||
|
// vignette
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleHeight(event) {
|
function toggleHeight(event) {
|
||||||
|
|
@ -846,24 +857,33 @@ function toggleMarkers(event) {
|
||||||
function toggleLabels(event) {
|
function toggleLabels(event) {
|
||||||
if (!layerIsOn("toggleLabels")) {
|
if (!layerIsOn("toggleLabels")) {
|
||||||
turnButtonOn("toggleLabels");
|
turnButtonOn("toggleLabels");
|
||||||
labels.style("display", null);
|
$("#labels").fadeIn();
|
||||||
invokeActiveZooming();
|
// don't redraw labels as they are not stored in data yet
|
||||||
|
if (labels.selectAll("text").size() === 0) drawLabels();
|
||||||
if (event && isCtrlClick(event)) editStyle("labels");
|
if (event && isCtrlClick(event)) editStyle("labels");
|
||||||
} else {
|
} else {
|
||||||
if (event && isCtrlClick(event)) return editStyle("labels");
|
if (event && isCtrlClick(event)) return editStyle("labels");
|
||||||
turnButtonOff("toggleLabels");
|
turnButtonOff("toggleLabels");
|
||||||
labels.style("display", "none");
|
$("#labels").fadeOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleIcons(event) {
|
function drawLabels() {
|
||||||
if (!layerIsOn("toggleIcons")) {
|
drawStateLabels();
|
||||||
turnButtonOn("toggleIcons");
|
drawBurgLabels();
|
||||||
|
invokeActiveZooming();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBurgIcons(event) {
|
||||||
|
if (!layerIsOn("toggleBurgIcons")) {
|
||||||
|
turnButtonOn("toggleBurgIcons");
|
||||||
$("#icons").fadeIn();
|
$("#icons").fadeIn();
|
||||||
|
drawBurgIcons();
|
||||||
if (event && isCtrlClick(event)) editStyle("burgIcons");
|
if (event && isCtrlClick(event)) editStyle("burgIcons");
|
||||||
} else {
|
} else {
|
||||||
if (event && isCtrlClick(event)) return editStyle("burgIcons");
|
if (event && isCtrlClick(event)) return editStyle("burgIcons");
|
||||||
turnButtonOff("toggleIcons");
|
turnButtonOff("toggleBurgIcons");
|
||||||
|
icons.selectAll("circle, use").remove();
|
||||||
$("#icons").fadeOut();
|
$("#icons").fadeOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -954,8 +974,7 @@ function getGappedFillPaths(elementName, fill, waterGap, color, index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function layerIsOn(el) {
|
function layerIsOn(el) {
|
||||||
const buttonoff = byId(el).classList.contains("buttonoff");
|
return byId(el).classList.contains("buttonoff") ? false : true;
|
||||||
return !buttonoff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function turnButtonOff(el) {
|
function turnButtonOff(el) {
|
||||||
|
|
@ -1002,7 +1021,7 @@ function getLayer(id) {
|
||||||
if (id === "toggleTexture") return $("#texture");
|
if (id === "toggleTexture") return $("#texture");
|
||||||
if (id === "toggleEmblems") return $("#emblems");
|
if (id === "toggleEmblems") return $("#emblems");
|
||||||
if (id === "toggleLabels") return $("#labels");
|
if (id === "toggleLabels") return $("#labels");
|
||||||
if (id === "toggleIcons") return $("#icons");
|
if (id === "toggleBurgIcons") return $("#icons");
|
||||||
if (id === "toggleMarkers") return $("#markers");
|
if (id === "toggleMarkers") return $("#markers");
|
||||||
if (id === "toggleRulers") return $("#ruler");
|
if (id === "toggleRulers") return $("#ruler");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,10 @@ toolsContent.addEventListener("click", function (event) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function processFeatureRegeneration(event, button) {
|
function processFeatureRegeneration(event, button) {
|
||||||
if (button === "regenerateStateLabels") drawStateLabels();
|
if (button === "regenerateStateLabels") {
|
||||||
else if (button === "regenerateReliefIcons") {
|
$("#labels").fadeIn();
|
||||||
|
drawStateLabels();
|
||||||
|
} else if (button === "regenerateReliefIcons") {
|
||||||
ReliefIcons.draw();
|
ReliefIcons.draw();
|
||||||
if (!layerIsOn("toggleRelief")) toggleRelief();
|
if (!layerIsOn("toggleRelief")) toggleRelief();
|
||||||
} else if (button === "regenerateRoutes") {
|
} else if (button === "regenerateRoutes") {
|
||||||
|
|
@ -440,7 +442,6 @@ function regenerateBurgs() {
|
||||||
|
|
||||||
BurgsAndStates.specifyBurgs();
|
BurgsAndStates.specifyBurgs();
|
||||||
BurgsAndStates.defineBurgFeatures();
|
BurgsAndStates.defineBurgFeatures();
|
||||||
BurgsAndStates.drawBurgs();
|
|
||||||
regenerateRoutes();
|
regenerateRoutes();
|
||||||
|
|
||||||
// remove emblems
|
// remove emblems
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ function getVertexPath(cellsArray) {
|
||||||
const vertexChain = connectVertices({vertices, startingVertex, ofSameType, addToChecked, closeRing: true});
|
const vertexChain = connectVertices({vertices, startingVertex, ofSameType, addToChecked, closeRing: true});
|
||||||
if (vertexChain.length < 3) continue;
|
if (vertexChain.length < 3) continue;
|
||||||
|
|
||||||
path += getFillPath(vertexChain);
|
path += getFillPath(vertices, vertexChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue