The SVG is now given a black rectangle as a background, and its top level element now has the proper xmlns attribute. Double-clicking the SVG renderer downloads the SVG as a file called "matrix.svg".

This commit is contained in:
Rezmason
2025-05-13 18:20:51 -07:00
parent 4bf94d7883
commit 3fef805c1f
3 changed files with 20 additions and 15 deletions

View File

@@ -34,19 +34,14 @@ export default async (artboard, config) => {
const rect = artboard.getBoundingClientRect();
[dimensions.width, dimensions.height] = [rect.width, rect.height];
if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
window.ondblclick = () => {
if (document.fullscreenElement == null) {
if (artboard.webkitRequestFullscreen != null) {
artboard.webkitRequestFullscreen();
} else {
artboard.requestFullscreen();
}
} else {
document.exitFullscreen();
}
};
}
window.ondblclick = () => {
const blob = new Blob([artboard.querySelector("svg").outerHTML], { type: "image/svg+xml" });
const url = URL.createObjectURL(blob);
const aTag = document.createElement("a");
aTag.download = 'matrix.svg';
aTag.href = window.URL.createObjectURL(blob);
aTag.click();
};
const effectName = config.effect in effects ? config.effect : "palette";
const context = { artboard, config };