fabric.js添加擦除画笔支持,来源于官方自定义构建(Erasing)作为npm包; fabric.js adds erasing brush support, sourced from the official custom build (Erasing) as an npm package.
npm install fabric-eraser-brush -S
import { fabric } from "fabric";
import "fabric-eraser-brush";
const canvas = new fabric.Canvas("canvas", {
isDrawingMode: true,
});
canvas.freeDrawingBrush = new fabric.EraserBrush(canvas);
canvas.freeDrawingBrush.width = 15; // optional
more usage see Erasing with Eraser Brush