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