Merge pull request #13947 from mike-000/exports
Fixes to export examples
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user