diff --git a/index.css b/index.css index 5682afa5..848e3124 100644 --- a/index.css +++ b/index.css @@ -25,7 +25,7 @@ button { #map { position: absolute; - background-color: #53679f; + background-color: #000000; mask-mode: alpha; mask-clip: no-clip; } diff --git a/main.js b/main.js index 55e3ef0c..83c449ff 100644 --- a/main.js +++ b/main.js @@ -74,7 +74,7 @@ scaleBar.on("mousemove", function() {tip("Click to open Units Editor");}) // ass // main data variables let grid = {}; // initial grapg based on jittered square grid 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 mapCoordinates = {}; // map coordinates on globe 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(); let graphWidth = +mapWidthInput.value; // voronoi graph extention, should be stable for each map 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); -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); -oceanLayers.append("rect").attr("id", "oceanBase").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", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight); // equator Y position limits equatorOutput.min = equatorInput.min = graphHeight * -1; @@ -228,7 +228,6 @@ function applyDefaultNamesData() { // apply default biomes data 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 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 i = new Uint8Array(d3.range(0, name.length)); diff --git a/modules/ui/general.js b/modules/ui/general.js index 6b8359a6..7b549922 100644 --- a/modules/ui/general.js +++ b/modules/ui/general.js @@ -6,8 +6,6 @@ window.onbeforeunload = () => "Are you sure you want to navigate away?"; // fit full-screen map if window is resized $(window).resize(function(e) { - // trick to prevent resize on download bar opening - if (autoResize === false) return; mapWidthInput.value = window.innerWidth; mapHeightInput.value = window.innerHeight; changeMapSize(); diff --git a/modules/ui/options.js b/modules/ui/options.js index f545bc9c..af8034b0 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -623,7 +623,6 @@ optionsContent.addEventListener("click", function(event) { function mapSizeInputChange() { changeMapSize(); - autoResize = false; localStorage.setItem("mapWidth", mapWidthInput.value); localStorage.setItem("mapHeight", mapHeightInput.value); } @@ -636,6 +635,9 @@ function changeMapSize() { const width = Math.max(svgWidth, graphWidth); const height = Math.max(svgHeight, graphHeight); 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(); } @@ -749,10 +751,6 @@ function changeZoomExtent(value) { const min = +zoomExtentMin.value; zoom.scaleExtent([min, +zoomExtentMax.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