Skip to content
Discussion options

You must be logged in to vote

I think what's happening is that each drawing path is always starting from the last x/y coordinate, then moving to the x/y coordinate given in ctx.arc, then drawing the circle and filling it in. This works fine in the first row of dots because the x value is the same and the y value keeps moving down, so the drawing path never creates a fillable shape other than the dot. But when the x value increases to the next row and the y value goes back down, the drawing path crosses itself, and then ctx.fill() fills in everything in the joined shape.

Anyway the fix is easy: just try adding ctx.beginPath(); right before the ctx.arc line to re-start the drawing path each time.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@becky-gilbert
Comment options

@Max-Lovell
Comment options

Answer selected by Max-Lovell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants