import { DataBase } from '../data'; import { CacheLayerAnimation, CacheLayerData, CacheLayerEvent, DrawBasicProps, DrawerTarget, DrawerType, ElConfig, LayerAnimation, LayerBaseProps, LayerScale, LayerStyle } from '../types'; import { EventManager } from '../utils'; export declare abstract class LayerBase { /** * Record raw data for layer elements. */ abstract data: Maybe; /** * Record style information for layer elements. */ abstract style: Maybe; /** * Preliminary conversion of raw data and styles into drawing data. * The update function is the main performance cost of the layer. */ abstract update(...args: unknown[]): void; /** * The drawing method of the layer, * which converts the drawing data generated by update into a format * that can be recognized by drawBasic. * @see drawBasic */ abstract draw(): void; /** * Declare what elements the layer contains. * Each sublayer is associated with a base element type. */ readonly sublayers: Key[]; /** * Declare which elements can interact. * The `interactive` must be a subset of sublayers. */ readonly interactive: Key[]; /** * Manage element events. */ readonly event: EventManager<`click-${Key}` | `mouseover-${Key}` | `mouseout-${Key}` | `mousemove-${Key}` | `mouseup-${Key}` | `mousedown-${Key}`, (props: { event: MouseEvent; data: ElConfig; target: EventTarget; }) => void>; /** * Manage lifecycle or tooltip events. */ readonly systemEvent: EventManager<"setData" | "setScale" | "setStyle" | "update" | "draw" | "destroy" | "drawBasic" | "playAnimation", AnyFunction>; readonly cacheAnimation: CacheLayerAnimation; readonly cacheEvent: CacheLayerEvent; readonly cacheData: CacheLayerData; readonly options: import("../types").LayerOptions; readonly log: { info(message: string, ...data: unknown[]): void; warn(message: string, ...data: unknown[]): void; error(message: string, ...data: unknown[]): void; debug: { info(message: string, ...data: unknown[]): void; warn(message: string, ...data: unknown[]): void; error(message: string, ...data: unknown[]): void; }; }; /** * In order to save unnecessary layer data calculation, * this property is used to identify whether the update function should be called. * @see update */ protected needRecalculated: boolean; /** * The root element of the layer below the chart root element. */ protected root: DrawerTarget; constructor({ options, sublayers, interactive }: LayerBaseProps); private initializeEvent; private initializeLifeCycles; /** * Set the data of the layer. * This method will force the layer to recalculate. * @see needRecalculated */ setData(_: Maybe): void; /** * Set the scale of the layer. * This method will force the layer to recalculate. * @see needRecalculated */ setScale(_: Maybe): void; /** * Set the style of the layer. * This method may force the layer to recalculate. * @see needRecalculated */ setStyle(_: Maybe>): void; /** * Set the animation of the layer and generate animation queues. * Calling this method will cause the animation in progress to stop. */ setAnimation(config: Maybe['options']>>): void; /** * Trigger the animation queue of all sublayers at the same time. * Be careful not to call this method frequently in a short period of time. */ playAnimation(): void; /** * Hide/Show layer or sublayer. * @param visible * Set the layer or sublayer to be visible or invisible. * @param sublayer * Specifies the sublayer to show/hide, undefined means the entire layer. */ setVisible(visible: boolean, sublayer?: Key): void; /** * After drawing, all elements need to be event bound. * @remarks * It should be noted that the click event only supports svg. * If canvas event is not corresponding, mostly because of element occlusion. * @param sublayer * The target elements. */ private bindEvent; /** * After drawing, all elements need to be animated. * @remarks * The number of animation queues is not fixed, * which means that not all sublayers have enter or loop animation. * @param sublayer * The target elements. */ private createAnimation; /** * Unified layer drawing function to map drawing data to graphics. * Layers should always be drawn using this method. */ protected drawBasic(props: DrawBasicProps): void; destroy(): void; }