diff --git a/index.html b/index.html index 74abf3e9..826fec00 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,12 @@ + + Azgaar's Fantasy Map Generator Demo @@ -21,13 +28,13 @@ - - + +
-

+

Loading...

@@ -753,5 +760,5 @@ Type: no - + \ No newline at end of file diff --git a/script.js b/script.js index 21e20fbd..def2702d 100644 --- a/script.js +++ b/script.js @@ -5665,6 +5665,26 @@ function fantasyMap() { if ($("body").hasClass("fullscreen")) {$("#statusbar").css("top", mapHeight - 20);} } + // fit full-screen map if window is resized + $(window).resize(function() { + if ($("body").hasClass("fullscreen")) { + console.log("resized"); + mapWidthInput.value = $(window).width(); + mapHeightInput.value = $(window).height(); + applyMapSize(); + oceanPattern.select("rect").attr("width", mapWidth).attr("height", mapHeight); + oceanLayers.select("rect").attr("width", mapWidth).attr("height", mapHeight); + zoom.translateExtent([[0, 0], [mapWidth, mapHeight]]); + $("#statusbar").css("top", mapHeight - 20); + if (d3.select("#scaleBar").size()) { + var bbox = d3.select("#scaleBar").node().getBBox(); + var tr = [mapWidth - 10 - bbox.width, mapHeight - 10 - bbox.height]; + d3.select("#scaleBar").attr("transform", "translate(" + rn(tr[0]) + "," + rn(tr[1]) + ")"); + localStorage.removeItem("scaleBar"); + } + } + }); + // Options handlers $("input, select").on("input change", function() { var id = this.id;