mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v 0.8.21b
This commit is contained in:
parent
dc7ebd7491
commit
602a5283df
4 changed files with 8 additions and 13 deletions
|
|
@ -25,7 +25,7 @@ button {
|
||||||
|
|
||||||
#map {
|
#map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #53679f;
|
background-color: #000000;
|
||||||
mask-mode: alpha;
|
mask-mode: alpha;
|
||||||
mask-clip: no-clip;
|
mask-clip: no-clip;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
main.js
9
main.js
|
|
@ -74,7 +74,7 @@ scaleBar.on("mousemove", function() {tip("Click to open Units Editor");}) // ass
|
||||||
// main data variables
|
// main data variables
|
||||||
let grid = {}; // initial grapg based on jittered square grid and data
|
let grid = {}; // initial grapg based on jittered square grid and data
|
||||||
let pack = {}; // packed graph and data
|
let pack = {}; // packed graph and data
|
||||||
let seed, mapHistory = [], elSelected, autoResize = true, modules = {}, notes = [];
|
let seed, mapHistory = [], elSelected, modules = {}, notes = [];
|
||||||
let customization = 0; // 0 - no; 1 = heightmap draw; 2 - states draw; 3 - add state/burg; 4 - cultures draw
|
let customization = 0; // 0 - no; 1 = heightmap draw; 2 - states draw; 3 - add state/burg; 4 - cultures draw
|
||||||
let mapCoordinates = {}; // map coordinates on globe
|
let mapCoordinates = {}; // map coordinates on globe
|
||||||
let winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
let winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
||||||
|
|
@ -92,10 +92,10 @@ const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", zoomed);
|
||||||
applyStoredOptions();
|
applyStoredOptions();
|
||||||
let graphWidth = +mapWidthInput.value; // voronoi graph extention, should be stable for each map
|
let graphWidth = +mapWidthInput.value; // voronoi graph extention, should be stable for each map
|
||||||
let graphHeight = +mapHeightInput.value;
|
let graphHeight = +mapHeightInput.value;
|
||||||
let svgWidth = graphWidth, svgHeight = graphHeight; // svg canvas resolution, can vary for each map
|
let svgWidth = graphWidth, svgHeight = graphHeight; // svg canvas resolution, can vary for each map
|
||||||
landmass.append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
|
landmass.append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
|
||||||
oceanPattern.append("rect").attr("fill", "url(#oceanic)").attr("x", graphWidth * -.2).attr("y", graphHeight * -.2).attr("width", graphWidth * 1.4).attr("height", graphHeight * 1.4);
|
oceanPattern.append("rect").attr("fill", "url(#oceanic)").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
|
||||||
oceanLayers.append("rect").attr("id", "oceanBase").attr("x", graphWidth * -.2).attr("y", graphHeight * -.2).attr("width", graphWidth * 1.4).attr("height", graphHeight * 1.4);
|
oceanLayers.append("rect").attr("id", "oceanBase").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
|
||||||
|
|
||||||
// equator Y position limits
|
// equator Y position limits
|
||||||
equatorOutput.min = equatorInput.min = graphHeight * -1;
|
equatorOutput.min = equatorInput.min = graphHeight * -1;
|
||||||
|
|
@ -228,7 +228,6 @@ function applyDefaultNamesData() {
|
||||||
// apply default biomes data
|
// apply default biomes data
|
||||||
function applyDefaultBiomesSystem() {
|
function applyDefaultBiomesSystem() {
|
||||||
const name = ["Marine","Hot desert","Cold desert","Savanna","Grassland","Tropical seasonal forest","Temperate deciduous forest","Tropical rain forest","Temperate rain forest","Taiga","Tundra","Glacier"];
|
const name = ["Marine","Hot desert","Cold desert","Savanna","Grassland","Tropical seasonal forest","Temperate deciduous forest","Tropical rain forest","Temperate rain forest","Taiga","Tundra","Glacier"];
|
||||||
//const color = ["#53679f","#fbfaae","#e1df9b","#eef586","#bdde82","#b6d95d","#29bc56","#7dcb35","#45b348","#567c2c","#d5d59d","#e6f5fa"];
|
|
||||||
const color = ["#53679f","#fbe79f","#b5b887","#d2d082","#c8d68f","#b6d95d","#29bc56","#7dcb35","#45b348","#4b6b32","#96784b","#d5e7eb"];
|
const color = ["#53679f","#fbe79f","#b5b887","#d2d082","#c8d68f","#b6d95d","#29bc56","#7dcb35","#45b348","#4b6b32","#96784b","#d5e7eb"];
|
||||||
|
|
||||||
const i = new Uint8Array(d3.range(0, name.length));
|
const i = new Uint8Array(d3.range(0, name.length));
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@ window.onbeforeunload = () => "Are you sure you want to navigate away?";
|
||||||
|
|
||||||
// fit full-screen map if window is resized
|
// fit full-screen map if window is resized
|
||||||
$(window).resize(function(e) {
|
$(window).resize(function(e) {
|
||||||
// trick to prevent resize on download bar opening
|
|
||||||
if (autoResize === false) return;
|
|
||||||
mapWidthInput.value = window.innerWidth;
|
mapWidthInput.value = window.innerWidth;
|
||||||
mapHeightInput.value = window.innerHeight;
|
mapHeightInput.value = window.innerHeight;
|
||||||
changeMapSize();
|
changeMapSize();
|
||||||
|
|
|
||||||
|
|
@ -623,7 +623,6 @@ optionsContent.addEventListener("click", function(event) {
|
||||||
|
|
||||||
function mapSizeInputChange() {
|
function mapSizeInputChange() {
|
||||||
changeMapSize();
|
changeMapSize();
|
||||||
autoResize = false;
|
|
||||||
localStorage.setItem("mapWidth", mapWidthInput.value);
|
localStorage.setItem("mapWidth", mapWidthInput.value);
|
||||||
localStorage.setItem("mapHeight", mapHeightInput.value);
|
localStorage.setItem("mapHeight", mapHeightInput.value);
|
||||||
}
|
}
|
||||||
|
|
@ -636,6 +635,9 @@ function changeMapSize() {
|
||||||
const width = Math.max(svgWidth, graphWidth);
|
const width = Math.max(svgWidth, graphWidth);
|
||||||
const height = Math.max(svgHeight, graphHeight);
|
const height = Math.max(svgHeight, graphHeight);
|
||||||
zoom.translateExtent([[0, 0], [width, height]]);
|
zoom.translateExtent([[0, 0], [width, height]]);
|
||||||
|
landmass.select("rect").attr("width", width).attr("height", height);
|
||||||
|
oceanPattern.select("rect").attr("fill", "url(#oceanic)").attr("width", width).attr("height", height);
|
||||||
|
oceanLayers.select("rect").attr("id", "oceanBase").attr("width", width).attr("height", height);
|
||||||
fitScaleBar();
|
fitScaleBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,10 +751,6 @@ function changeZoomExtent(value) {
|
||||||
const min = +zoomExtentMin.value;
|
const min = +zoomExtentMin.value;
|
||||||
zoom.scaleExtent([min, +zoomExtentMax.value]);
|
zoom.scaleExtent([min, +zoomExtentMax.value]);
|
||||||
zoom.scaleTo(svg, +value);
|
zoom.scaleTo(svg, +value);
|
||||||
const x = min < 1 ? (graphWidth / min - graphWidth) / 2 : graphWidth * .2;
|
|
||||||
const y = min < 1 ? (graphHeight / min - graphHeight) / 2 : graphHeight * .2;
|
|
||||||
oceanPattern.select("rect").attr("x", -x).attr("y", -y).attr("width", graphWidth + 2 * x).attr("height", graphHeight + 2 * y);
|
|
||||||
oceanLayers.select("rect").attr("x", -x).attr("y", -y).attr("width", graphWidth + 2 * x).attr("height", graphHeight + 2 * y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// control sroted options
|
// control sroted options
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue