mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.4.04
This commit is contained in:
parent
a2b93f1396
commit
8152ccbe9c
4 changed files with 12 additions and 10 deletions
|
|
@ -1797,7 +1797,8 @@
|
|||
<input data-tip="Maximal possible zoom level (should be > 1)" id="zoomExtentMax" class="paired" type="number" min=1 max=50 value=20>
|
||||
</td>
|
||||
<td>
|
||||
<i data-tip="Restore default [1, 20] zoom extent" id="zoomExtentDefault" class="icon-ccw"></i>
|
||||
<i data-tip="Restore default zoom extent (1, 20)" id="zoomExtentDefault" class="icon-ccw"></i>
|
||||
<i data-tip="Allow to drag map beyond canvas borders" id="translateExtent" data-on=0 class="icon-hand-paper-o"></i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
@ -2186,7 +2187,7 @@
|
|||
</div>
|
||||
|
||||
<button id="coastlineEditStyle" data-tip="Edit coastline group style in Style Editor" class="icon-brush"></button>
|
||||
<button id="coastlineArea" data-tip="Lake area in selected units">0</button>
|
||||
<button id="coastlineArea" data-tip="Landmass area in selected units">0</button>
|
||||
</div>
|
||||
|
||||
<div id="reliefEditor" class="dialog" style="display: none">
|
||||
|
|
|
|||
2
main.js
2
main.js
|
|
@ -952,8 +952,6 @@ function drawCoastline() {
|
|||
const waterMask = defs.select("#water");
|
||||
lineGen.curve(d3.curveBasisClosed);
|
||||
|
||||
zoom.translateExtent([[-200, -200],[graphWidth+200, graphHeight+200]]);
|
||||
|
||||
for (const i of cells.i) {
|
||||
const startFromEdge = !i && cells.h[i] >= 20;
|
||||
if (!startFromEdge && cells.t[i] !== -1 && cells.t[i] !== 1) continue; // non-edge cell
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function editCoastline(node = d3.event.target) {
|
|||
lineGen.curve(d3.curveBasisClosed);
|
||||
const f = +elSelected.attr("data-f");
|
||||
const vertices = pack.features[f].vertices;
|
||||
const points = vertices.map(v => pack.vertices.p[v]);
|
||||
const points = clipPoly(vertices.map(v => pack.vertices.p[v]), 1);
|
||||
const d = round(lineGen(points));
|
||||
elSelected.attr("d", d);
|
||||
defs.select("mask#land > path#land_"+f).attr("d", d); // update land mask
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ optionsContent.addEventListener("click", function(event) {
|
|||
else if (id === "optionsMapHistory") showSeedHistoryDialog();
|
||||
else if (id === "optionsCopySeed") copyMapURL();
|
||||
else if (id === "zoomExtentDefault") restoreDefaultZoomExtent();
|
||||
else if (id === "translateExtent") toggleTranslateExtent(event.target);
|
||||
});
|
||||
|
||||
function mapSizeInputChange() {
|
||||
|
|
@ -138,7 +139,6 @@ function changeMapSize() {
|
|||
landmass.select("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight);
|
||||
oceanPattern.select("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight);
|
||||
oceanLayers.select("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight);
|
||||
//defs.select("#mapClip > rect").attr("width", maxWidth).attr("height", maxHeight);
|
||||
|
||||
fitScaleBar();
|
||||
if (window.fitLegendBox) fitLegendBox();
|
||||
|
|
@ -152,10 +152,7 @@ function applyMapSize() {
|
|||
svgWidth = Math.min(graphWidth, window.innerWidth);
|
||||
svgHeight = Math.min(graphHeight, window.innerHeight);
|
||||
svg.attr("width", svgWidth).attr("height", svgHeight);
|
||||
zoom.translateExtent([[0, 0],[graphWidth, graphHeight]]).scaleExtent([zoomMin, zoomMax]).scaleTo(svg, zoomMin);
|
||||
//viewbox.attr("transform", null).attr("clip-path", "url(#mapClip)");
|
||||
//defs.append("clipPath").attr("id", "mapClip").append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
|
||||
//zoom.translateExtent([[-svgWidth*.2, -graphHeight*.2], [svgWidth*1.2, graphHeight*1.2]]);
|
||||
zoom.translateExtent([[0, 0], [graphWidth, graphHeight]]).scaleExtent([zoomMin, zoomMax]).scaleTo(svg, zoomMin);
|
||||
}
|
||||
|
||||
function toggleFullscreen() {
|
||||
|
|
@ -171,6 +168,12 @@ function toggleFullscreen() {
|
|||
changeMapSize();
|
||||
}
|
||||
|
||||
function toggleTranslateExtent(el) {
|
||||
const on = el.dataset.on = +!(+el.dataset.on);
|
||||
if (on) zoom.translateExtent([[-graphWidth/2, -graphHeight/2], [graphWidth*1.5, graphHeight*1.5]]);
|
||||
else zoom.translateExtent([[0, 0], [graphWidth, graphHeight]]);
|
||||
}
|
||||
|
||||
function generateMapWithSeed() {
|
||||
if (optionsSeed.value == seed) {
|
||||
tip("The current map already has this seed", false, "error");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue