strange tear lines when adding dots to on top of squares in keyboard-canvas-response #1953
-
can anyone elaborate as to why this happens?
CSS file (can be removed): #jspsych-canvas-stimulus { #jspsych-content.text { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 Anyway the fix is easy: just try adding |
Beta Was this translation helpful? Give feedback.
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 thenctx.fill()
fills in everything in the joined shape.Anyway the fix is easy: just try adding
ctx.beginPath();
right before thectx.arc
line to re-start the drawing path each time.