Skip to content

Commit

Permalink
fix: when image src is an image instance, rendering will not be trigg…
Browse files Browse the repository at this point in the history
…ered by default (#1827)
  • Loading branch information
wang1212 authored Nov 11, 2024
1 parent 57fd6ac commit 92b43d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-suns-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/g-plugin-image-loader': patch
---

fix: when image src is an image instance, rendering will not be triggered by default
26 changes: 12 additions & 14 deletions packages/g-plugin-image-loader/src/LoadImagePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@ export class LoadImagePlugin implements RenderingPlugin {
if (nodeName === Shape.IMAGE) {
const { src, keepAspectRatio } = attributes;

if (isString(src)) {
imagePool.getImageSync(
src,
object as DisplayObject,
({ img: { width, height } }) => {
if (keepAspectRatio) {
calculateWithAspectRatio(object, width, height);
}
imagePool.getImageSync(
src,
object as DisplayObject,
({ img: { width, height } }) => {
if (keepAspectRatio) {
calculateWithAspectRatio(object, width, height);
}

// set dirty rectangle flag
object.renderable.dirty = true;
renderingService.dirtify();
},
);
}
// set dirty rectangle flag
object.renderable.dirty = true;
renderingService.dirtify();
},
);
}
};

Expand Down

0 comments on commit 92b43d1

Please sign in to comment.