1 | import Element, { ElementProps, ElementStatePropNames, ElementAnimateConfig, ElementCommonState } from '../Element';
|
2 | import BoundingRect from '../core/BoundingRect';
|
3 | import { PropType, Dictionary, MapToType } from '../core/types';
|
4 | import Path from './Path';
|
5 | import Animator from '../animation/Animator';
|
6 | export interface CommonStyleProps {
|
7 | shadowBlur?: number;
|
8 | shadowOffsetX?: number;
|
9 | shadowOffsetY?: number;
|
10 | shadowColor?: string;
|
11 | opacity?: number;
|
12 | blend?: string;
|
13 | }
|
14 | export declare const DEFAULT_COMMON_STYLE: CommonStyleProps;
|
15 | export declare const DEFAULT_COMMON_ANIMATION_PROPS: MapToType<DisplayableProps, boolean>;
|
16 | export interface DisplayableProps extends ElementProps {
|
17 | style?: Dictionary<any>;
|
18 | zlevel?: number;
|
19 | z?: number;
|
20 | z2?: number;
|
21 | culling?: boolean;
|
22 | cursor?: string;
|
23 | rectHover?: boolean;
|
24 | progressive?: boolean;
|
25 | incremental?: boolean;
|
26 | ignoreCoarsePointer?: boolean;
|
27 | batch?: boolean;
|
28 | invisible?: boolean;
|
29 | }
|
30 | declare type DisplayableKey = keyof DisplayableProps;
|
31 | declare type DisplayablePropertyType = PropType<DisplayableProps, DisplayableKey>;
|
32 | export declare type DisplayableStatePropNames = ElementStatePropNames | 'style' | 'z' | 'z2' | 'invisible';
|
33 | export declare type DisplayableState = Pick<DisplayableProps, DisplayableStatePropNames> & ElementCommonState;
|
34 | interface Displayable<Props extends DisplayableProps = DisplayableProps> {
|
35 | animate(key?: '', loop?: boolean): Animator<this>;
|
36 | animate(key: 'style', loop?: boolean): Animator<this['style']>;
|
37 | getState(stateName: string): DisplayableState;
|
38 | ensureState(stateName: string): DisplayableState;
|
39 | states: Dictionary<DisplayableState>;
|
40 | stateProxy: (stateName: string) => DisplayableState;
|
41 | }
|
42 | declare class Displayable<Props extends DisplayableProps = DisplayableProps> extends Element<Props> {
|
43 | invisible: boolean;
|
44 | z: number;
|
45 | z2: number;
|
46 | zlevel: number;
|
47 | culling: boolean;
|
48 | cursor: string;
|
49 | rectHover: boolean;
|
50 | incremental: boolean;
|
51 | ignoreCoarsePointer?: boolean;
|
52 | style: Dictionary<any>;
|
53 | protected _normalState: DisplayableState;
|
54 | protected _rect: BoundingRect;
|
55 | protected _paintRect: BoundingRect;
|
56 | protected _prevPaintRect: BoundingRect;
|
57 | dirtyRectTolerance: number;
|
58 | useHoverLayer?: boolean;
|
59 | __hoverStyle?: CommonStyleProps;
|
60 | __clipPaths?: Path[];
|
61 | __canvasFillGradient: CanvasGradient;
|
62 | __canvasStrokeGradient: CanvasGradient;
|
63 | __canvasFillPattern: CanvasPattern;
|
64 | __canvasStrokePattern: CanvasPattern;
|
65 | __svgEl: SVGElement;
|
66 | constructor(props?: Props);
|
67 | protected _init(props?: Props): void;
|
68 | beforeBrush(): void;
|
69 | afterBrush(): void;
|
70 | innerBeforeBrush(): void;
|
71 | innerAfterBrush(): void;
|
72 | shouldBePainted(viewWidth: number, viewHeight: number, considerClipPath: boolean, considerAncestors: boolean): boolean;
|
73 | contain(x: number, y: number): boolean;
|
74 | traverse<Context>(cb: (this: Context, el: this) => void, context?: Context): void;
|
75 | rectContain(x: number, y: number): boolean;
|
76 | getPaintRect(): BoundingRect;
|
77 | setPrevPaintRect(paintRect: BoundingRect): void;
|
78 | getPrevPaintRect(): BoundingRect;
|
79 | animateStyle(loop: boolean): Animator<this["style"]>;
|
80 | updateDuringAnimation(targetKey: string): void;
|
81 | attrKV(key: DisplayableKey, value: DisplayablePropertyType): void;
|
82 | setStyle(obj: Props['style']): this;
|
83 | setStyle<T extends keyof Props['style']>(obj: T, value: Props['style'][T]): this;
|
84 | dirtyStyle(notRedraw?: boolean): void;
|
85 | dirty(): void;
|
86 | styleChanged(): boolean;
|
87 | styleUpdated(): void;
|
88 | createStyle(obj?: Props['style']): Props["style"];
|
89 | useStyle(obj: Props['style']): void;
|
90 | isStyleObject(obj: Props['style']): any;
|
91 | protected _innerSaveToNormal(toState: DisplayableState): void;
|
92 | protected _applyStateObj(stateName: string, state: DisplayableState, normalState: DisplayableState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void;
|
93 | protected _mergeStates(states: DisplayableState[]): DisplayableState;
|
94 | protected _mergeStyle(targetStyle: CommonStyleProps, sourceStyle: CommonStyleProps): CommonStyleProps;
|
95 | getAnimationStyleProps(): MapToType<DisplayableProps, boolean>;
|
96 | protected static initDefaultProps: void;
|
97 | }
|
98 | export default Displayable;
|