Drawing Tool

Basic Features

Step 7: Start drawing when the user moves the mouse on the canvas with the mouse held down.
Hint: Use a mouseover event listener:
yourCanvasVariable.addEventListener(`mouseover`, startDrawing)
Then check if the user is holding down the mouse by checking the MouseEvent buttons property:
function startDrawing(event) {
  // check if the left mouse button is pressed
  if (event.buttons == 1) {
    // your existing code here
  }
}
Last step Next step