@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.
63 lines (62 loc) • 2.24 kB
TypeScript
import { IRectangleOptions } from "../options/interfaces/IRectangleOptions.js";
import { IRectangleStyle } from "../styles/interfaces/IRectangleStyle.js";
import { Rectangle } from "./Rectangle.js";
/**
* Class representing a Square, extending the Rectangle class.
* Provides functionality for rendering, resizing, moving, and rotating the square.
*/
export declare class Square extends Rectangle {
/**
* Constructs a new Square instance.
*
* @param x - The x-coordinate of the square's position.
* @param y - The y-coordinate of the square's position.
* @param size - The size (width/height) of the square.
* @param rotation - The initial rotation of the square in degrees clockwise.
* @param style - The style options for the square.
* @param options - The configuration options for the square.
*/
constructor(x: number, y: number, size: number, rotation?: number, style?: IRectangleStyle, options?: IRectangleOptions);
/**
* Gets the size (widht/height) of the square.
* @returns The size of the square.
*/
get size(): number;
/**
* Gets the height of the square.
* @returns The height of the square.
*/
get height(): number;
/**
* Gets the width of the square.
* @returns The width of the square.
*/
get width(): number;
/**
* Sets the size (width/height) of the square.
* @param size - The new size of the square.
*/
set size(size: number);
/**
* Sets the height of the square and updates the width with same value.
* @param height - The new height of the square.
*/
set height(height: number);
/**
* Sets the width of the square and updates the height with same value.
* @param width - The new width of the square.
*/
set width(width: number);
/**
* Updates the size of the square by setting new width and height values.
*
* @param size - The new width and height of the square.
*/
setSize(size: number): void;
/**
* Resizes the rectangle by adjusting the current size, width and height by delta value.
*
* @param deltaSize - The change in width.
*/
resize(deltaSize: number): void;
}