UNPKG

@avolutions/canvas-painter

Version:

CanvasPainter.js is a simple yet powerful JavaScript library for drawing basic shapes (rectangles, circles, etc.) on HTML5 Canvas with ease. Perfect for creating 2D graphics in your web projects.

29 lines (28 loc) 950 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CanvasStyle = void 0; const CanvasCursorStyle_js_1 = require("./CanvasCursorStyle.js"); /** * Class representing the style of a canvas. */ class CanvasStyle { /** * Creates a new instance of CanvasStyle. * * @param style - The partial style provided by the user. */ constructor(style = {}) { // Handle partial CanvasCursorStyle const canvasCursorStyle = new CanvasCursorStyle_js_1.CanvasCursorStyle(style.cursor || {}); const styleWithDefaults = Object.assign(Object.assign(Object.assign({}, CanvasStyle.DefaultStyle), style), { cursor: canvasCursorStyle }); Object.assign(this, styleWithDefaults); } } exports.CanvasStyle = CanvasStyle; /** * Default style for the canvas. */ CanvasStyle.DefaultStyle = { color: '#000000', cursor: CanvasCursorStyle_js_1.CanvasCursorStyle.DefaultStyle };