From 404dfa1c917336e1272c50234ef18397b5bdb013 Mon Sep 17 00:00:00 2001 From: juacom99 Date: Mon, 21 Feb 2022 17:32:06 -0300 Subject: [PATCH] Fix Height Map preview download image size (#746) --- modules/ui/heightmap-editor.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js index ed4457778..40d6af97e 100644 --- a/modules/ui/heightmap-editor.js +++ b/modules/ui/heightmap-editor.js @@ -1317,15 +1317,15 @@ function editHeightmap() { img.src = dataURL; img.onload = function () { - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - canvas.width = svgWidth; - canvas.height = svgHeight; + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + canvas.width = graphWidth; + canvas.height = graphHeight; document.body.insertBefore(canvas, optionsContainer); - ctx.drawImage(img, 0, 0, svgWidth, svgHeight); - const imgBig = canvas.toDataURL('image/png'); - const link = document.createElement('a'); - link.download = getFileName('Heightmap') + '.png'; + ctx.drawImage(img, 0, 0, graphWidth, graphHeight); + const imgBig = canvas.toDataURL("image/png"); + const link = document.createElement("a"); + link.download = getFileName("Heightmap") + ".png"; link.href = imgBig; link.click(); canvas.remove();