mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
refactoring for row based code
This commit is contained in:
parent
b640f977b9
commit
db49f1c924
7 changed files with 50 additions and 21 deletions
|
|
@ -229,6 +229,7 @@ async function parseLoadedData(data) {
|
|||
if (settings[22]) stylePreset.value = settings[22];
|
||||
if (settings[23]) rescaleLabels.checked = +settings[23];
|
||||
if (settings[24]) urbanDensity = urbanDensityInput.value = urbanDensityOutput.value = +settings[24];
|
||||
if (settings[25]) gridAlgorithm.value = settings[25];
|
||||
})();
|
||||
|
||||
void (function applyOptionsToUI() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ function getMapData() {
|
|||
+hideLabels.checked,
|
||||
stylePreset.value,
|
||||
+rescaleLabels.checked,
|
||||
urbanDensity
|
||||
urbanDensity,
|
||||
byId('gridAlgorithm').value,
|
||||
].join("|");
|
||||
const coords = JSON.stringify(mapCoordinates);
|
||||
const biomes = [biomesData.color, biomesData.habitability, biomesData.name].join("|");
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ window.Submap = (function () {
|
|||
|
||||
// create new grid
|
||||
applyMapSize();
|
||||
grid = generateGrid();
|
||||
grid = generateGrid(options.gridAlgorithm);
|
||||
|
||||
drawScaleBar(scale);
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ window.UISubmap = (function () {
|
|||
WARN && console.warn("Resampling current map");
|
||||
const cellNumId = +byId("submapPointsInput").value;
|
||||
if (!cellsDensityMap[cellNumId]) return console.error("Unknown cell number!");
|
||||
const gridAlgorithm = window[document.getElementById('gridAlgorithm').value];
|
||||
|
||||
const {angle, shiftX, shiftY, ratio, mirrorH, mirrorV} = getTransformInput();
|
||||
|
||||
|
|
@ -203,6 +204,7 @@ window.UISubmap = (function () {
|
|||
smoothHeightMap: false,
|
||||
rescaleStyles: false,
|
||||
scale: 1,
|
||||
gridAlgorithm,
|
||||
projection,
|
||||
inverse
|
||||
});
|
||||
|
|
@ -229,7 +231,8 @@ window.UISubmap = (function () {
|
|||
smoothHeightMap: scale > 2,
|
||||
inverse: (x, y) => [x / origScale + x0, y / origScale + y0],
|
||||
projection: (x, y) => [(x - x0) * origScale, (y - y0) * origScale],
|
||||
scale: origScale
|
||||
scale: origScale,
|
||||
gridAlgorithm: window[byId('gridAlgorithm').value],
|
||||
};
|
||||
|
||||
// converting map position on the planet
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue