import { GetColorCallBack } from './types'; /** * Defines one canvas */ declare class CanvasComponent { /** * The canvas element */ private $el; /** * This is a hidden canvas element * which is used to redraw all the elements from the canvas * in unique colors. * * This way an element can be easily identified from this hit canvas * just by using the color in O(1) * * Otherwise to identify an element in the canvas it will take O(n) * */ private $hitEl; /** * The color generator for generating new color */ private colorGenerator; /** * The current hovering color */ private currentHoveringColor; /** * For storing the on hover callback */ private onHoverCB?; /** * For storing the on click callback */ private onClickCB?; /** * For constructing a new canvas component * * @param {HTMLCanvasElement} $el */ constructor($el: HTMLCanvasElement); /** * Clears the canvas */ clearCanvas(): void; /** * Set the maximum width and height * * @param {number} height * @param {number} width */ setMaxWidthAndHeight(height: number, width: number): void; /** * Get the hit 2d context * * @return {CanvasComponent} */ getHitContext(): CanvasRenderingContext2D; /** * Get the 2d context * * @return {CanvasRenderingContext2D} */ getContext(): CanvasRenderingContext2D; /** * Get the next color from the color generator * * @return {string} */ getNextColor(): string; /** * On hover get the canvas hit color * * @param {GetColorCallBack} cb */ onHover(cb: GetColorCallBack): void; /** * On click of canvas get the hit color * * @param {GetColorCallBack} cb */ onClick(cb: GetColorCallBack): void; } export default CanvasComponent;