UNPKG

illustrator.js

Version:

JavaScript image processing library

29 lines (28 loc) 637 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolBox = void 0; class ToolBox { constructor(layer, autoClear = false) { this.layer = layer; this.autoClear = autoClear; this.history = []; } save() { this.history.push((ctx) => { ctx.save(); }); return this; } restore() { this.history.push((ctx) => { ctx.restore(); }); return this; } render() { this.layer.applyTool(this); if (this.autoClear) this.history = []; } } exports.ToolBox = ToolBox;