@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.
42 lines (41 loc) • 939 B
JavaScript
import { Cursor } from "../types/Cursor.js";
import { ShapeStyle } from "./ShapeStyle.js";
/**
* Represents the style options for a circle.
*/
export class CircleStyle extends ShapeStyle {
/**
* The color of the border.
*/
borderColor;
/**
* The width of the border in pixels.
*/
borderWidth;
/**
* The fill color of the circle.
*/
color;
/**
* Default style for the circle.
*/
static DefaultStyle = {
borderColor: '#000000',
borderWidth: 0,
color: '#000000',
cursor: Cursor.Default
};
/**
* Creates a new instance of CircleStyle.
*
* @param style - The partial style provided by the user.
*/
constructor(style = {}) {
super();
const styleWithDefaults = {
...CircleStyle.DefaultStyle,
...style
};
Object.assign(this, styleWithDefaults);
}
}