Bugfix: In creation of a new app, only one image is now shown

This commit is contained in:
Isoporhode
2021-11-14 23:57:33 +01:00
parent 7e38eb96eb
commit 5304703563
+27 -27
View File
@@ -4331,33 +4331,34 @@ const AppCreator = (props) => {
canvas.height = 174; canvas.height = 174;
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
img.onload = function () { if (img)
// img, x, y, width, height img.onload = function () {
//ctx.drawImage(img, 174, 174) // img, x, y, width, height
//console.log("IMG natural: ", img.naturalWidth, img.naturalHeight) //ctx.drawImage(img, 174, 174)
//ctx.drawImage(img, 0, 0, 174, 174) //console.log("IMG natural: ", img.naturalWidth, img.naturalHeight)
ctx.drawImage( //ctx.drawImage(img, 0, 0, 174, 174)
img, ctx.drawImage(
0, img,
0, 0,
img.width, 0,
img.height, img.width,
0, img.height,
0, 0,
canvas.width, 0,
canvas.height canvas.width,
); canvas.height
);
try { try {
const canvasUrl = canvas.toDataURL(); const canvasUrl = canvas.toDataURL();
if (canvasUrl !== fileBase64) { if (canvasUrl !== fileBase64) {
//console.log("SET URL TO: ", canvasUrl) //console.log("SET URL TO: ", canvasUrl)
setFileBase64(canvasUrl); setFileBase64(canvasUrl);
}
} catch (e) {
alert.error("Failed to parse canvasurl!");
} }
} catch (e) { };
alert.error("Failed to parse canvasurl!");
}
};
//console.log(img.width) //console.log(img.width)
//console.log(img.width) //console.log(img.width)
@@ -4626,8 +4627,7 @@ const AppCreator = (props) => {
setOpenImageModal(true); setOpenImageModal(true);
}} }}
> >
{!imageData && alternateImg} {imageData ? imageInfo : alternateImg}
{imageInfo}
<input <input
hidden hidden
type="file" type="file"