Fabricjs 橡皮擦、取消橡皮擦、绘画、选择和喷雾
作者:互联网
case "select": //选择 canvas.isDrawingMode = false //取消绘画模式 break; case "erase": //橡皮擦 canvas.freeDrawingBrush = new fabric.EraserBrush(canvas); canvas.freeDrawingBrush.width = 10; canvas.isDrawingMode = true; break; case "undo": //取消橡皮擦 canvas.freeDrawingBrush = new fabric.EraserBrush(canvas); canvas.freeDrawingBrush.width = 10; canvas.freeDrawingBrush.inverted = true //倒转的 canvas.isDrawingMode = true break; case "draw": //绘画 canvas.freeDrawingBrush = new fabric.PencilBrush(canvas); canvas.freeDrawingBrush.width = 5; canvas.isDrawingMode = true; break; case "spray": //喷雾器 canvas.freeDrawingBrush = new fabric.SprayBrush(canvas); canvas.freeDrawingBrush.width = 35 canvas.isDrawingMode = true;
代码是直接复制的,重点是canvas的属性值
标签:case,橡皮擦,isDrawingMode,freeDrawingBrush,Fabricjs,canvas,喷雾,true 来源: https://www.cnblogs.com/em2464/p/16078289.html