I have create a canvas to render a svg after it has been manipulated via a form. Simple things like adding text to certain areas.
It works perfect in all browsers bar Firefox. I have checked and all the code seem to be supported via FireFox and the code does function except the canvas never shows anything.
Here is the code used to draw to the canvas.
function createTie_Base() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const svgContainer = document.getElementById('hiddenSVG_Base');
const svgElm = document.getElementById('Layer_1');
console.log(svgElm)
let cloneSvgElm = svgElm.cloneNode(true);
let blob = new Blob([cloneSvgElm.outerHTML], {
type: 'image/svg+xml;charset=UTF-8',
});
let URL = window.URL || window.webkitURL || window;
let blobURL = URL.createObjectURL(blob);
let svgImg = new Image();
svgImg.src = blobURL;
svgImg.onload = () => {
if(productType === "scarf"){
let half = canvas.width / 2
let quarter = half / 2
console.log(half,quarter)
ctx.drawImage(svgImg, quarter, 0, half, canvas.height);
}else{
ctx.drawImage(svgImg, 0, 0, canvas.width, canvas.height);
}
if (inputText[0].checked) {
addText_Handler();
} else {
createTie_Shadow()
}
};
}
Has anyone else experienced this and have a work around or can see a problem why it doesn't work on FireFox?
I have check that Firefox supports the code being used, With no error codes I am unsure on how to debug this issue.