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 =
|
const opacity =
|
||||||
canvas.parentNode.style.opacity || canvas.style.opacity;
|
canvas.parentNode.style.opacity || canvas.style.opacity;
|
||||||
mapContext.globalAlpha = opacity === '' ? 1 : Number(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;
|
let matrix;
|
||||||
const transform = canvas.style.transform;
|
const transform = canvas.style.transform;
|
||||||
if (transform) {
|
if (transform) {
|
||||||
@@ -94,11 +87,17 @@ document.getElementById('export-png').addEventListener('click', function () {
|
|||||||
mapContext,
|
mapContext,
|
||||||
matrix
|
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.drawImage(canvas, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
mapContext.globalAlpha = 1;
|
mapContext.globalAlpha = 1;
|
||||||
|
mapContext.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
const link = document.getElementById('image-download');
|
const link = document.getElementById('image-download');
|
||||||
link.href = mapCanvas.toDataURL();
|
link.href = mapCanvas.toDataURL();
|
||||||
link.click();
|
link.click();
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ exportButton.addEventListener(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
mapContext.globalAlpha = 1;
|
mapContext.globalAlpha = 1;
|
||||||
|
mapContext.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
const pdf = new jspdf.jsPDF('landscape', undefined, format);
|
const pdf = new jspdf.jsPDF('landscape', undefined, format);
|
||||||
pdf.addImage(
|
pdf.addImage(
|
||||||
mapCanvas.toDataURL('image/jpeg'),
|
mapCanvas.toDataURL('image/jpeg'),
|
||||||
|
|||||||
Reference in New Issue
Block a user