You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Iam looking to show some gridlines when i load the sketchpad. something like this
I used the below function to draw the grid. but the lines disapper as soon i start writing on the sketchpad
drawGrid(ctx, w, h, step) {
// ctx.beginPath();
ctx.beginPath();
for (var y = 0; y <= h; y += step) {
ctx.moveTo(0, y);
ctx.lineTo(w, y);
}
// set the color of the line
ctx.strokeStyle = 'rgb(20,20,20)';
// just for fun
ctx.lineWidth = 1;
// for your original question - you need to stroke only once
ctx.stroke();
}
The text was updated successfully, but these errors were encountered:
Hi, Iam looking to show some gridlines when i load the sketchpad. something like this

I used the below function to draw the grid. but the lines disapper as soon i start writing on the sketchpad
drawGrid(ctx, w, h, step) {
// ctx.beginPath();
ctx.beginPath();
for (var y = 0; y <= h; y += step) {
ctx.moveTo(0, y);
ctx.lineTo(w, y);
}
// set the color of the line
ctx.strokeStyle = 'rgb(20,20,20)';
// just for fun
ctx.lineWidth = 1;
// for your original question - you need to stroke only once
ctx.stroke();
}
The text was updated successfully, but these errors were encountered: