jakubfiala / atrament

A small JS library for beautiful drawing and handwriting on the HTML Canvas.
http://fiala.space/atrament/demo
MIT License
1.56k stars 115 forks source link

fixed fill tool not working on mobile #38

Closed rubenanton90 closed 6 years ago

rubenanton90 commented 6 years ago

closes #37 When mouseX/mouseY have decimal digits, the algorithm miscalculates the starting position in which to apply the colorPixel function. This causes the colorData array to be misaligned. ie, filling the whole picture with (100,50,20,255) results in a color data array of [255,100,50,20,255,100,50,20...] instead of the correct [100,50,20,255,100,50,20,255...] which results in strange behaviors.

Fixed the issue by flooring X and Y starting values, though there may be a better fix for the algorithm itself