as.addEventListener('click',handleSelection);
function startDrawing(e){
isDrawing=true;
[lastX,lastY]=getCanvasCoordinates(e);
draw(e);
}
function draw(e){
if(!isDrawing)return;
const [x,y]=getCanvasCoordinates(e);
if(currentTool==='pen'||currentTool==='eraser'){
maskCtx.lineWidth=brushSize.value;
maskCtx.lineCap='round';
maskCtx.lineJoin='round';
if(currentTool==='pen'){
maskCtx.globalCompositeOperation='source-over';
maskCtx.strokeStyle=colorPicker.value;
maskCtx.fillStyle=colorPicker.value;
}else{
maskCt