mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
refactor: submap - continue
This commit is contained in:
parent
58ccd238f6
commit
fb7d232aae
6 changed files with 241 additions and 356 deletions
|
|
@ -17,8 +17,8 @@ function openSubmapTool() {
|
|||
}
|
||||
});
|
||||
|
||||
if (modules.openSubmapMenu) return;
|
||||
modules.openSubmapMenu = true;
|
||||
if (modules.openSubmapTool) return;
|
||||
modules.openSubmapTool = true;
|
||||
|
||||
async function generateSubmap() {
|
||||
INFO && console.group("generateSubmap");
|
||||
|
|
@ -34,18 +34,15 @@ function openSubmapTool() {
|
|||
byId("mapSizeInput").value = mapSizeOutput.value;
|
||||
byId("latitudeInput").value = latitudeOutput.value;
|
||||
|
||||
distanceScale = distanceScaleInput.value = rn(distanceScaleInput.value / scale, 2);
|
||||
populationRate = populationRateInput.value = rn(populationRateInput.value / scale, 2);
|
||||
distanceScale = distanceScaleInput.value = rn(distanceScale / scale, 2);
|
||||
populationRate = populationRateInput.value = rn(populationRate / scale, 2);
|
||||
|
||||
const parentMap = {grid: deepCopy(grid), pack: deepCopy(pack), notes: deepCopy(notes)};
|
||||
const options = {
|
||||
lockMarkers: byId("submapLockMarkers").checked,
|
||||
lockBurgs: byId("submapLockBurgs").checked,
|
||||
smoothHeightmap: byId("submapSmoothHeightmap").checked,
|
||||
depressRivers: byId("submapDepressRivers").checked,
|
||||
addLakesInDepressions: byId("submapAddLakeInDepression").checked,
|
||||
smoothHeightMap: scale > 2,
|
||||
inverse: (x, y) => [x / scale + x0, y / scale + y0],
|
||||
projection: (x, y) => [(x - x0) * scale, (y - y0) * scale],
|
||||
inverse: (x, y) => [x / scale + x0, y / scale + y0],
|
||||
scale
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ async function openTransformTool() {
|
|||
|
||||
const options = {noWater: true, fullMap: true, noLabels: true, noScaleBar: true, noVignette: true, noIce: true};
|
||||
const url = await getMapURL("png", options);
|
||||
const SCALE = 4;
|
||||
|
||||
const img = new Image();
|
||||
img.src = url;
|
||||
|
|
@ -52,9 +53,9 @@ async function openTransformTool() {
|
|||
const $canvas = byId("transformPreviewCanvas");
|
||||
$canvas.style.width = width + "px";
|
||||
$canvas.style.height = height + "px";
|
||||
$canvas.width = width * 2;
|
||||
$canvas.height = height * 2;
|
||||
$canvas.getContext("2d").drawImage(img, 0, 0, width * 2, height * 2);
|
||||
$canvas.width = width * SCALE;
|
||||
$canvas.height = height * SCALE;
|
||||
$canvas.getContext("2d").drawImage(img, 0, 0, width * SCALE, height * SCALE);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -124,16 +125,7 @@ async function openTransformTool() {
|
|||
|
||||
const parentMap = {grid: deepCopy(grid), pack: deepCopy(pack), notes: deepCopy(notes)};
|
||||
const [projection, inverse] = getProjection();
|
||||
const options = {
|
||||
lockMarkers: false,
|
||||
lockBurgs: false,
|
||||
depressRivers: false,
|
||||
addLakesInDepressions: false,
|
||||
smoothHeightMap: false,
|
||||
scale: 1,
|
||||
inverse,
|
||||
projection
|
||||
};
|
||||
const options = {depressRivers: false, smoothHeightmap: false, scale: 1, inverse, projection};
|
||||
|
||||
const cellsNumber = +byId("transformPointsInput").value;
|
||||
changeCellsDensity(cellsNumber);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue