UNPKG

1.3 kBTypeScriptView Raw
1import Displayable, { DisplayableProps, CommonStyleProps, DisplayableStatePropNames } from './Displayable';
2import BoundingRect from '../core/BoundingRect';
3import { ImageLike, MapToType } from '../core/types';
4import { ElementCommonState } from '../Element';
5export interface ImageStyleProps extends CommonStyleProps {
6 image?: string | ImageLike;
7 x?: number;
8 y?: number;
9 width?: number;
10 height?: number;
11 sx?: number;
12 sy?: number;
13 sWidth?: number;
14 sHeight?: number;
15}
16export declare const DEFAULT_IMAGE_STYLE: CommonStyleProps;
17export declare const DEFAULT_IMAGE_ANIMATION_PROPS: MapToType<ImageProps, boolean>;
18export interface ImageProps extends DisplayableProps {
19 style?: ImageStyleProps;
20 onload?: (image: ImageLike) => void;
21}
22export declare type ImageState = Pick<ImageProps, DisplayableStatePropNames> & ElementCommonState;
23declare class ZRImage extends Displayable<ImageProps> {
24 style: ImageStyleProps;
25 __image: ImageLike;
26 __imageSrc: string;
27 onload: (image: ImageLike) => void;
28 createStyle(obj?: ImageStyleProps): ImageStyleProps;
29 private _getSize;
30 getWidth(): number;
31 getHeight(): number;
32 getAnimationStyleProps(): MapToType<ImageProps, boolean>;
33 getBoundingRect(): BoundingRect;
34}
35export default ZRImage;