-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(IconManager) Fix icon frame x/y for auto packed icons #9928
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
Conversation
|
@Pessimistress could you review this, since I think you'll have the most SA based on #7651? |
|
|
||
| private _onUpdate(): void { | ||
| this.setNeedsRedraw(); | ||
| this.getAttributeManager()?.invalidate('getIcon'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an expensive operation called on every icon image load. Pass a flag to onUpdate for whether icon frame is changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
Pessimistress
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Background
When auto packing is enabled, the icon manager must reserve space for the width/height declared by the icon definition, even before icon is loaded. After an icon loads, it is resized and centered in that reserved space/box. #7651 fixed a bug where the icon image itself would be stretched to completely fill the box, distorting the icon if it had an aspect ratio which differed from that of the box. However, for the icon mapping that the icon manager returns, that PR only updated the width/height fields, and not the x/y. So when retrieving a mapping, an icon frame would be returned with the correct size, but not centered where the actual icon is, resulting in icons not displaying properly.
Change List