Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/graphic/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import BoundingRect from '../core/BoundingRect';
import { ImageLike, MapToType } from '../core/types';
import { defaults, createObject } from '../core/util';
import { ElementCommonState } from '../Element';
import {isImageReady} from "./helper/image";

export interface ImageStyleProps extends CommonStyleProps {
image?: string | ImageLike
Expand Down Expand Up @@ -117,7 +118,14 @@ class ZRImage extends Displayable<ImageProps> {
style.x || 0, style.y || 0, this.getWidth(), this.getHeight()
);
}
return this._rect;

const rect = this._rect;
//If the image hasn't loaded, ensure to obtain the correct value next time.
if (this.__image && !isImageReady(this.__image)) {
this._rect = null
}

return rect;
}
}

Expand Down