UNPKG

illustrator.js

Version:

JavaScript image processing library

24 lines (23 loc) 748 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EraserTool = void 0; const ToolBox_1 = require("../base/ToolBox"); class EraserTool extends ToolBox_1.ToolBox { rectangular(options) { this.history.push((ctx) => { ctx.clearRect(options.x, options.y, options.width, options.height); }); return this; } circular(options) { this.history.push((ctx) => { ctx.beginPath(); ctx.arc(options.x, options.y, options.radius ?? 50, 0, 2 * Math.PI); ctx.clip(); ctx.clearRect(0, 0, this.layer.width, this.layer.height); ctx.closePath(); }); return this; } } exports.EraserTool = EraserTool;