heightmap select - style fixes

This commit is contained in:
Azgaar 2022-05-27 02:22:25 +03:00 committed by Peter
parent e1cbca2546
commit 48e36fa26c
3 changed files with 28 additions and 2 deletions

View file

@ -24,8 +24,12 @@
font-size: 10px; font-size: 10px;
overflow: hidden; overflow: hidden;
} }
#map { #loading > * {
position: absolute; pointer-events: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} }
#loading > * { #loading > * {
pointer-events: none; pointer-events: none;
@ -117,6 +121,7 @@
id="map" id="map"
width="100%" width="100%"
height="100%" height="100%"
style="position: absolute"
version="1.1" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"

View file

@ -96,6 +96,19 @@ function appendStyleSheet() {
justify-self: end; justify-self: end;
} }
@media (max-width: 600px) {
.heightmap-selection_container {
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
grid-gap: 4px;
}
}
@media (min-width: 2000px) {
.heightmap-selection_container {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
}
.heightmap-selection article { .heightmap-selection article {
padding: 4px; padding: 4px;
border-radius: 8px; border-radius: 8px;
@ -308,6 +321,13 @@ async function drawPrecreatedHeightmap(id) {
article.querySelector("img").src = dataUrl; article.querySelector("img").src = dataUrl;
} }
async function drawPrecreatedHeightmap(id) {
const heights = await HeightmapGenerator.fromPrecreated(id);
const dataUrl = drawHeights(heights);
const article = byId("heightmapSelection").querySelector(`[data-id="${id}"]`);
article.querySelector("img").src = dataUrl;
}
function regeneratePreview(article, id) { function regeneratePreview(article, id) {
graph = getGraph(graph); graph = getGraph(graph);
const seed = generateSeed(); const seed = generateSeed();

View file

@ -510,6 +510,7 @@ window.HeightmapGenerator = (function () {
const powered = lightness < 0.2 ? lightness : 0.2 + (lightness - 0.2) ** 0.8; const powered = lightness < 0.2 ? lightness : 0.2 + (lightness - 0.2) ** 0.8;
heights[i] = minmax(Math.floor(powered * 100), 0, 100); heights[i] = minmax(Math.floor(powered * 100), 0, 100);
} }
return heights;
} }
return { return {