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.

37 lines (36 loc) 814 B
import { Cursor } from "../types/Cursor.js"; import { ShapeStyle } from "./ShapeStyle.js"; /** * Represents the style options for a line. */ export class LineStyle extends ShapeStyle { /** * The color of the line stroke. */ color; /** * The width of the line stroke. */ width; /** * Default style for the line. */ static DefaultStyle = { color: '#000000', cursor: Cursor.Default, width: 1, }; /** * Creates a new instance of LineStyle. * * @param style - The partial style provided by the user. */ constructor(style = {}) { super(); const styleWithDefaults = { ...LineStyle.DefaultStyle, ...style }; Object.assign(this, styleWithDefaults); } }