tweak fix for screenshot

trunk
vilmibm 2023-08-04 02:40:22 +00:00
parent 7a2ad27484
commit c355a87b71
1 changed files with 9 additions and 4 deletions

View File

@ -64,6 +64,9 @@
#paper span { #paper span {
cursor: help; cursor: help;
}
.shifted {
/* hack for the image download. without this, thin white artifacting at span margins */ /* hack for the image download. without this, thin white artifacting at span margins */
margin-left:-1px; margin-left:-1px;
} }
@ -79,14 +82,10 @@
@media (hover: hover) { @media (hover: hover) {
#paper span:hover { #paper span:hover {
background-color: white; background-color: white;
/* hack for the image download. without this, thin white artifacting at span margins */
margin-left:-1px;
} }
#paper span.black:hover { #paper span.black:hover {
background-color: grey; background-color: grey;
/* hack for the image download. without this, thin white artifacting at span margins */
margin-left:-1px;
} }
} }
@ -174,7 +173,13 @@
const downloadImgButton = document.querySelector("#downloadImage"); const downloadImgButton = document.querySelector("#downloadImage");
downloadImgButton.addEventListener("animationend", () => downloadImgButton.classList.remove("rainbow"), false); downloadImgButton.addEventListener("animationend", () => downloadImgButton.classList.remove("rainbow"), false);
downloadImgButton.addEventListener("click", () => { downloadImgButton.addEventListener("click", () => {
document.querySelectorAll("#paper span").forEach(span => {
span.classList.add("shifted");
})
html2canvas(document.querySelector("#paper")).then((canvas) => { html2canvas(document.querySelector("#paper")).then((canvas) => {
document.querySelectorAll("#paper span").forEach(span => {
span.classList.remove("shifted");
})
canvas.toBlob((blob) => { canvas.toBlob((blob) => {
/* /*
// can't use this because ff doesn't have support by default for clipboard.write() // can't use this because ff doesn't have support by default for clipboard.write()