<canvas width="600" height="400"></canvas>
<script>
let tela = document.querySelector('canvas');
let pincel = tela.getContext('2d');
pincel.fillStyle = 'grey';
pincel.fillRect(0, 0, 600, 400);
let draw=false;
function desenharCirculo(e){
if(draw){
let x = e.pageX - tela.offsetLeft;
let y = e.pageY - tela.offsetTop;
pincel.fillStyle = 'blue';
pincel.beginPath();
pincel.arc(x, y, 10, 0, 2*Math.PI);
pincel.fill();
}
}
tela.addEventListener('mousemove', desenharCirculo);
tela.addEventListener('mousedown', () => draw = true);
tela.addEventListener('mouseup', () => draw = false);
</script>