import Layer, { ILayerEvent, ILayerState } from './Layer'; import { ISketchUtils } from './Sketch'; export interface IRectProps { /** * 宽 */ w: number; /** * 高 */ h: number; /** * 线段样式 */ dash: readonly number[] | null; } export interface IRectEvent extends ILayerEvent { w: (w: IRectProps['w']) => void; h: (h: IRectProps['h']) => void; dash: (dash: IRectProps['dash']) => void; } /** * 绘制矩形 */ export default class Rect extends Layer { props: IRectProps; constructor(state?: Partial, props?: Partial); /** * 设置尺寸 * @param w 宽 * @param h 高 */ size(w: number, h?: number): this; /** * 设置线段样式 */ dash(value: IRectProps['dash']): this; protected _clone(): Rect; protected _render(ctx: CanvasRenderingContext2D, utils: ISketchUtils): void; }