From 7c4f685a57384b4b72a9a087b4c31c94570383cd Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 28 May 2022 01:47:25 +0300 Subject: [PATCH] refactor dialogs to be mobile-friendly --- modules/dynamic/heightmap-selection.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/dynamic/heightmap-selection.js b/modules/dynamic/heightmap-selection.js index 6c2bc9f5..5b3f6484 100644 --- a/modules/dynamic/heightmap-selection.js +++ b/modules/dynamic/heightmap-selection.js @@ -1,6 +1,7 @@ const initialSeed = generateSeed(); let graph = getGraph(grid); +const initialSeed = generateSeed(); appendStyleSheet(); insertHtml(); addListeners(); @@ -321,6 +322,13 @@ async function drawPrecreatedHeightmap(id) { article.querySelector("img").src = dataUrl; } +function drawTemplatePreview(id) { + const heights = generateHeightmap(id); + const dataUrl = drawHeights(heights); + const article = byId("heightmapSelection").querySelector(`[data-id="${id}"]`); + article.querySelector("img").src = dataUrl; +} + async function drawPrecreatedHeightmap(id) { const heights = await HeightmapGenerator.fromPrecreated(id); const dataUrl = drawHeights(heights);