diff --git a/examples/export-map.js b/examples/export-map.js index 9794c3a5d8..0c35307b70 100644 --- a/examples/export-map.js +++ b/examples/export-map.js @@ -64,13 +64,6 @@ document.getElementById('export-png').addEventListener('click', function () { const opacity = canvas.parentNode.style.opacity || canvas.style.opacity; mapContext.globalAlpha = opacity === '' ? 1 : Number(opacity); - - const backgroundColor = canvas.parentNode.style.backgroundColor; - if (backgroundColor) { - mapContext.fillStyle = backgroundColor; - mapContext.fillRect(0, 0, canvas.width, canvas.height); - } - let matrix; const transform = canvas.style.transform; if (transform) { @@ -94,11 +87,17 @@ document.getElementById('export-png').addEventListener('click', function () { mapContext, matrix ); + const backgroundColor = canvas.parentNode.style.backgroundColor; + if (backgroundColor) { + mapContext.fillStyle = backgroundColor; + mapContext.fillRect(0, 0, canvas.width, canvas.height); + } mapContext.drawImage(canvas, 0, 0); } } ); mapContext.globalAlpha = 1; + mapContext.setTransform(1, 0, 0, 1, 0, 0); const link = document.getElementById('image-download'); link.href = mapCanvas.toDataURL(); link.click(); diff --git a/examples/export-pdf.js b/examples/export-pdf.js index 12163b1340..ae1b169b9a 100644 --- a/examples/export-pdf.js +++ b/examples/export-pdf.js @@ -84,6 +84,7 @@ exportButton.addEventListener( } ); mapContext.globalAlpha = 1; + mapContext.setTransform(1, 0, 0, 1, 0, 0); const pdf = new jspdf.jsPDF('landscape', undefined, format); pdf.addImage( mapCanvas.toDataURL('image/jpeg'),