pencil.js
Version:
Nice modular interactive 2D drawing library.
83 lines (82 loc) • 2.12 kB
TypeScript
/**
* @module Rectangle
*/
/**
* Basic rectangle
* <br><img src="./media/examples/rectangle.png" alt="rectangle demo"/>
* @class
* @extends {module:Component}
*/
export default class Rectangle {
/**
* @inheritDoc
* @param {Object} definition - Rectangle definition
* @return {Rectangle}
*/
static from(definition: any): Rectangle;
/**
* @typedef {Object} RectangleOptions
* @extends ComponentOptions
* @prop {Number|Array<Number>} rounded - Corner radius or an array of radii [top-left, top-right, bottom-right, bottom-left]
*/
/**
* @type {RectangleOptions}
*/
static get defaultOptions(): any;
/**
* @typedef {Object} RectangleOrigins
* @prop {String} topLeft
* @prop {String} topRight
* @prop {String} topCenter
* @prop {String} center
* @prop {String} centerLeft
* @prop {String} centerRight
* @prop {String} bottomLeft
* @prop {String} bottomRight
* @prop {String} bottomCenter
*/
/**
* @type {RectangleOrigins}
*/
static get origins(): {
topLeft: string;
topRight: string;
topCenter: string;
center: string;
centerLeft: string;
centerRight: string;
bottomLeft: string;
bottomRight: string;
bottomCenter: string;
};
/**
* Rectangle constructor
* @param {PositionDefinition} positionDefinition - Position in space
* @param {Number} [width=0] - Horizontal size
* @param {Number} [height=0] - Vertical size
* @param {RectangleOptions} [options] - Drawing options
*/
constructor(positionDefinition: PositionDefinition, width?: number, height?: number, options?: any);
/**
* @type {Number}
*/
width: number;
/**
* @type {Number}
*/
height: number;
/**
* Draw the rectangle
* @param {path} path - Drawing context
* @return {Rectangle} Itself
*/
trace(path: any): Rectangle;
/**
* @inheritDoc
*/
getOrigin(): any;
/**
* @inheritDoc
*/
toJSON(): any;
}