Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the size of an unloaded Image is 0 #1831

Merged
merged 1 commit into from
Nov 13, 2024
Merged

fix: the size of an unloaded Image is 0 #1831

merged 1 commit into from
Nov 13, 2024

Conversation

wang1212
Copy link
Member

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / Document optimization
  • TypeScript definition update
  • Refactoring
  • Performance improvement
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

The src property of the Image object of G allows passing a window.Image instances without waiting for the onload event to complete. If the user does not explicitly specify the width and height, the image will be rendered with a width and height of 0 pixels, resulting in rendering anomalies.

💡 Background and solution

If the user sets the src attribute before the onload event is triggered, G should render internally by listening to the onload event and obtaining the correct width and height attributes of the window.Image instance.

📝 Changelog

Language Changelog
🇺🇸 English fix: the size of an unloaded Image is 0
🇨🇳 Chinese fix: 未加载的 Image 尺寸为 0

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@wang1212 wang1212 added the bug label Nov 13, 2024
@wang1212 wang1212 merged commit abebed9 into release Nov 13, 2024
3 checks passed
@wang1212 wang1212 deleted the fix-image branch November 13, 2024 10:40
wang1212 added a commit that referenced this pull request Nov 13, 2024
* fix: rough canvas rendering error (#1830)

* fix: rough canvas rendering error

* chore: add changeset

* refactor: iterator forEach method now has compatibility

* fix: the size of an unloaded Image is 0 (#1831)

* Version Packages (#1832)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants