low-earth-orbit / konva-whiteboard

A simple whiteboard app built using Konva library.
https://whiteboard.leohong.dev/
MIT License
2 stars 2 forks source link

Implement proper partial erasing #66

Open low-earth-orbit opened 1 month ago

low-earth-orbit commented 1 month ago

Currently eraser paths are invisible lines, i.e. objects. This needs to be fixed.

low-earth-orbit commented 1 month ago

For the following reasons, I originally wanted to implement partial erasing instead of using the eraser stroke as a mask:

  1. Canvas zoom-to-fit checks the bounding box size of all canvas objects.
    • If the eraser stroke is treated as an object, the zoom will not fit what the user is actually seeing.
    • Excluding the eraser stroke from the bounding box calculation alone doesn’t work because a line could be completely erased.
  2. If no visible objects exist, the delete button should be disabled.

I tried to implement partial erasing logic that removes points from a line object, but it seems too convoluted, and the computation time is too long.

low-earth-orbit commented 1 month ago

If anyone comes across this and knows more about it, please suggest a solution. My branch is eraser-fix.