refactoring for row based code

This commit is contained in:
GoteGuru 2022-06-19 00:11:46 +02:00
parent b640f977b9
commit db49f1c924
7 changed files with 50 additions and 21 deletions

View file

@ -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() {

View file

@ -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("|");

View file

@ -40,7 +40,7 @@ window.Submap = (function () {
// create new grid
applyMapSize();
grid = generateGrid();
grid = generateGrid(options.gridAlgorithm);
drawScaleBar(scale);

View file

@ -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