mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
v 0.8.04b
This commit is contained in:
parent
0ada9d4c7d
commit
9aa369b6df
4 changed files with 15 additions and 11 deletions
|
|
@ -3,19 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-116735150-1"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
gtag('config', 'UA-116735150-1');
|
|
||||||
</script>
|
|
||||||
<title>Azgaar's Fantasy Map Generator</title>
|
<title>Azgaar's Fantasy Map Generator</title>
|
||||||
<meta name="application-name" content="Azgaar's Fantasy Map Generator">
|
<meta name="application-name" content="Azgaar's Fantasy Map Generator">
|
||||||
<meta name="author" content="Azgaar (Max Ganiev)">
|
<meta name="author" content="Azgaar (Max Ganiev)">
|
||||||
<meta name="description" content="Azgaar's Fantasy Map Generator and Editor">
|
<meta name="description" content="Azgaar's Fantasy Map Generator and Editor">
|
||||||
<meta name="google" content="notranslate">
|
<meta name="google" content="notranslate">
|
||||||
<meta property="og:url" content="https://azgaar.github.io/Fantasy-Map-Generator/">
|
<meta property="og:url" content="https://azgaar.github.io/Fantasy-Map-Generator">
|
||||||
<meta property="og:title" content="Azgaar's Fantasy Map Generator">
|
<meta property="og:title" content="Azgaar's Fantasy Map Generator">
|
||||||
<meta property="og:description" content="Based on Voronoi diagram rendered to svg">
|
<meta property="og:description" content="Based on Voronoi diagram rendered to svg">
|
||||||
<meta property="og:image" content="images/preview.png">
|
<meta property="og:image" content="images/preview.png">
|
||||||
|
|
|
||||||
|
|
@ -433,10 +433,10 @@
|
||||||
void function drawLabels() {
|
void function drawLabels() {
|
||||||
const g = labels.select("#states"), p = defs.select("#textPaths");
|
const g = labels.select("#states"), p = defs.select("#textPaths");
|
||||||
g.selectAll("text").remove();
|
g.selectAll("text").remove();
|
||||||
p.selectAll("path").remove();
|
p.selectAll("path[id*='stateLabel']").remove();
|
||||||
|
|
||||||
const data = paths.map(p => [round(lineGen(p[1])), "stateLabel"+p[0], states[p[0]].name, p[1]]);
|
const data = paths.map(p => [round(lineGen(p[1])), "stateLabel"+p[0], states[p[0]].name, p[1]]);
|
||||||
p.selectAll("path").data(data).enter().append("path").attr("d", d => d[0]).attr("id", d => "textPath_"+d[1]);
|
p.selectAll(".path").data(data).enter().append("path").attr("d", d => d[0]).attr("id", d => "textPath_"+d[1]);
|
||||||
|
|
||||||
g.selectAll("text").data(data).enter()
|
g.selectAll("text").data(data).enter()
|
||||||
.append("text").attr("id", d => d[1])
|
.append("text").attr("id", d => d[1])
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ function addBurg(point) {
|
||||||
|
|
||||||
const population = Math.max((cells.s[cell] + cells.road[cell]) / 3 + i / 1000 + cell % 100 / 1000, .1);
|
const population = Math.max((cells.s[cell] + cells.road[cell]) / 3 + i / 1000 + cell % 100 / 1000, .1);
|
||||||
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: false, port: 0, population});
|
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: false, port: 0, population});
|
||||||
|
cells.burg[cell] = i;
|
||||||
|
|
||||||
const townSize = burgIcons.select("#towns").attr("size") || 0.5;
|
const townSize = burgIcons.select("#towns").attr("size") || 0.5;
|
||||||
burgIcons.select("#towns").append("circle").attr("id", "burg"+i).attr("data-id", i)
|
burgIcons.select("#towns").append("circle").attr("id", "burg"+i).attr("data-id", i)
|
||||||
|
|
|
||||||
|
|
@ -467,8 +467,18 @@ function editStates() {
|
||||||
const basename = center%5 === 0 ? pack.burgs[burg].name : Names.getCulture(culture);
|
const basename = center%5 === 0 ? pack.burgs[burg].name : Names.getCulture(culture);
|
||||||
const name = Names.getState(basename, culture);
|
const name = Names.getState(basename, culture);
|
||||||
const color = d3.color(d3.scaleSequential(d3.interpolateRainbow)(Math.random())).hex();
|
const color = d3.color(d3.scaleSequential(d3.interpolateRainbow)(Math.random())).hex();
|
||||||
|
|
||||||
|
pack.cells.state[center] = pack.states.length;
|
||||||
|
pack.cells.c[center].forEach(c => {
|
||||||
|
if (pack.cells.h[c] < 20) return;
|
||||||
|
if (pack.cells.burg[c]) return;
|
||||||
|
pack.cells.state[c] = pack.states.length;
|
||||||
|
});
|
||||||
pack.states.push({i:pack.states.length, name, color, expansionism:.5, capital:burg, type:"Generic", center, culture});
|
pack.states.push({i:pack.states.length, name, color, expansionism:.5, capital:burg, type:"Generic", center, culture});
|
||||||
recalculateStates();
|
|
||||||
|
if (!layerIsOn("toggleStates")) toggleStates(); else drawStatesWithBorders();
|
||||||
|
if (adjustLabels.checked) BurgsAndStates.drawStateLabels();
|
||||||
|
refreshStatesEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitAddStateMode() {
|
function exitAddStateMode() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue