mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Update main.js (#722)
This commit is contained in:
parent
a55e8d96ff
commit
71a3d05334
1 changed files with 6 additions and 6 deletions
12
main.js
12
main.js
|
|
@ -109,7 +109,7 @@ scaleBar.on("mousemove", () => tip("Click to open Units Editor")).on("click", ()
|
||||||
legend.on("mousemove", () => tip("Drag to change the position. Click to hide the legend")).on("click", () => clearLegend());
|
legend.on("mousemove", () => tip("Drag to change the position. Click to hide the legend")).on("click", () => clearLegend());
|
||||||
|
|
||||||
// main data variables
|
// main data variables
|
||||||
let grid = {}; // initial grapg based on jittered square grid and data
|
let grid = {}; // initial graph based on jittered square grid and data
|
||||||
let pack = {}; // packed graph and data
|
let pack = {}; // packed graph and data
|
||||||
let seed;
|
let seed;
|
||||||
let mapId;
|
let mapId;
|
||||||
|
|
@ -160,7 +160,7 @@ let urbanDensity = +document.getElementById("urbanDensityInput").value;
|
||||||
|
|
||||||
applyStoredOptions();
|
applyStoredOptions();
|
||||||
|
|
||||||
// voronoi graph extention, cannot be changed arter generation
|
// voronoi graph extension, cannot be changed after generation
|
||||||
let graphWidth = +mapWidthInput.value;
|
let graphWidth = +mapWidthInput.value;
|
||||||
let graphHeight = +mapHeightInput.value;
|
let graphHeight = +mapHeightInput.value;
|
||||||
|
|
||||||
|
|
@ -492,7 +492,7 @@ function invokeActiveZooming() {
|
||||||
coastline.select("#sea_island").attr("filter", filter);
|
coastline.select("#sea_island").attr("filter", filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rescale lables on zoom
|
// rescale labels on zoom
|
||||||
if (labels.style("display") !== "none") {
|
if (labels.style("display") !== "none") {
|
||||||
labels.selectAll("g").each(function () {
|
labels.selectAll("g").each(function () {
|
||||||
if (this.id === "burgLabels") return;
|
if (this.id === "burgLabels") return;
|
||||||
|
|
@ -667,7 +667,7 @@ function generate() {
|
||||||
const parsedError = parseError(error);
|
const parsedError = parseError(error);
|
||||||
clearMainTip();
|
clearMainTip();
|
||||||
|
|
||||||
alertMessage.innerHTML = `An error is occured on map generation. Please retry.
|
alertMessage.innerHTML = `An error has occurred on map generation. Please retry.
|
||||||
<br>If error is critical, clear the stored data and try again.
|
<br>If error is critical, clear the stored data and try again.
|
||||||
<p id="errorBox">${parsedError}</p>`;
|
<p id="errorBox">${parsedError}</p>`;
|
||||||
$("#alert").dialog({
|
$("#alert").dialog({
|
||||||
|
|
@ -1183,7 +1183,7 @@ function reGraph() {
|
||||||
TIME && console.timeEnd("reGraph");
|
TIME && console.timeEnd("reGraph");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect and draw the coasline
|
// Detect and draw the coastline
|
||||||
function drawCoastline() {
|
function drawCoastline() {
|
||||||
TIME && console.time("drawCoastline");
|
TIME && console.time("drawCoastline");
|
||||||
reMarkFeatures();
|
reMarkFeatures();
|
||||||
|
|
@ -1192,7 +1192,7 @@ function drawCoastline() {
|
||||||
vertices = pack.vertices,
|
vertices = pack.vertices,
|
||||||
n = cells.i.length,
|
n = cells.i.length,
|
||||||
features = pack.features;
|
features = pack.features;
|
||||||
const used = new Uint8Array(features.length); // store conneted features
|
const used = new Uint8Array(features.length); // store connected features
|
||||||
const largestLand = d3.scan(
|
const largestLand = d3.scan(
|
||||||
features.map(f => (f.land ? f.cells : 0)),
|
features.map(f => (f.land ? f.cells : 0)),
|
||||||
(a, b) => b - a
|
(a, b) => b - a
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue