canvas = {
url;
const img1 = new Image();
img1.src = urls[url];
img1.crossOrigin = "anonymous";
const canvas = DOM.canvas(),
ctx = canvas.getContext("2d");
canvas.onclick = (e) => {
console.log(e, e.target, e.offsetX, e.offsetY);
Object.assign(curveCoordinate, { x: e.offsetX, y: e.offsetY });
const ctx = canvas.getContext("2d");
const { ctxWidth, ctxHeight } = curveCoordinate;
ctx.drawImage(img1, 0, 0, ctxWidth, ctxHeight);
drawCurve(ctx);
};
img1.onload = function () {
const { width: imgWidth, height: imgHeight } = img;
const { ctxWidth, ctxHeight } = fitCtxSize(img);
Object.assign(canvas, { width: ctxWidth, height: ctxHeight });
ctx.drawImage(img, 0, 0, ctxWidth, ctxHeight);
drawCurve(ctx);
};
return canvas;
}