Skip to content

Commit

Permalink
Fix Height Map preview download image size (Azgaar#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
juacom99 authored and sofronaspe committed Nov 22, 2022
1 parent 5dc18bd commit 404dfa1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/ui/heightmap-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 404dfa1

Please sign in to comment.