A simple erasing tool. Currently supports fabric out of the box.
npm i erase2d
import { EraserBrush } from 'erase2d';
const eraser = new EraserBrush(canvas);
eraser.width = 30;
canvas.freeDrawingBrush = eraser;
canvas.isDrawingMode = true;
// prevent from committing erasing to the tree
eraser.on('end', (e) => e.preventDefault())
The logic has been reworked from the bottom.
Eraser
has been removed in favor of the leaner ClippingGroup
.
Replacing the type
in your data should be enough.
- type: 'eraser'
+ type: 'clipping'
npm start
npm version <type>
npm publish