embiem / react-canvas-draw

React Component for drawing in canvas
https://embiem.github.io/react-canvas-draw/
MIT License
892 stars 315 forks source link

Missing points when drawing #88

Closed oreporan closed 4 years ago

oreporan commented 4 years ago

Hi I'm trying to use this library to draw on an image, and then take the points drawn and create a new canvas with the image on it (rather than using the image as a background) However when I try to re-draw the points that I got from getSavedData() , I get spaced-out points

While Drawing:

Screen Shot 2020-06-10 at 9 50 28

After drawing the points on a new canvas:

Screen Shot 2020-06-10 at 9 50 41

My function for drawing:

 lines.forEach(({points, brushColor, brushRadius}) => {
            ctx.fillStyle = brushColor;
            points.forEach(({x, y}) => {
                ctx.fillRect(x, y, brushRadius, brushRadius);
            });
        });

Any ideas why?

oreporan commented 4 years ago

switched to use lineTo()