PathFinding.js
PathFinding.js copied to clipboard
when drawing walls very fast, the walls have holes
steps to reproduce
Drag the mouse very quickly across the grid, in any shape.
expected
I get a continuous line of walls where I dragged my mouse.
actual
I get walls only in some of those places. Though I dragged the shape of one continuous wall, the wall has big holes.
how to implement
- When drawing walls, while the mouse is down, ...
- instead of just drawing a wall under the current cursor position, ...
- always remember the last cursor position, and use a line-drawing algorithm to draw a continuous line from the previous position to the current position.