Image.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import Displayable, { DisplayableProps, CommonStyleProps, DisplayableStatePropNames } from './Displayable';
  2. import BoundingRect from '../core/BoundingRect';
  3. import { ImageLike, MapToType } from '../core/types';
  4. import { ElementCommonState } from '../Element';
  5. export 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. }
  16. export declare const DEFAULT_IMAGE_STYLE: CommonStyleProps;
  17. export declare const DEFAULT_IMAGE_ANIMATION_PROPS: MapToType<ImageProps, boolean>;
  18. export interface ImageProps extends DisplayableProps {
  19. style?: ImageStyleProps;
  20. onload?: (image: ImageLike) => void;
  21. }
  22. export declare type ImageState = Pick<ImageProps, DisplayableStatePropNames> & ElementCommonState;
  23. declare 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. }
  35. export default ZRImage;