1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 22:18:34 +01:00

Remove all elements from a UiSystem when it is disposed

This commit is contained in:
Ell 2023-05-22 11:29:41 +02:00
parent b2f457088d
commit 2463c27a5d
2 changed files with 9 additions and 0 deletions

View file

@ -44,6 +44,7 @@ Improvements
- Improved the SquishingGroup algorithm by prioritizing each element's final size - Improved the SquishingGroup algorithm by prioritizing each element's final size
- Allow specifying start and end indices when drawing a Paragraph - Allow specifying start and end indices when drawing a Paragraph
- Allow elements with larger children to influence a panel's scrollable area - Allow elements with larger children to influence a panel's scrollable area
- Remove all elements from a UiSystem when it is disposed
Fixes Fixes
- Fixed images not updating their hidden state properly when the displayed texture changes - Fixed images not updating their hidden state properly when the displayed texture changes

View file

@ -419,6 +419,14 @@ namespace MLEM.Ui {
root.Element.AndChildren(action); root.Element.AndChildren(action);
} }
/// <inheritdoc />
protected override void Dispose(bool disposing) {
if (disposing) {
while (this.rootElements.Count > 0)
this.Remove(this.rootElements[0].Name);
}
}
internal void InvokeOnElementDrawn(Element element, GameTime time, SpriteBatch batch, float alpha) { internal void InvokeOnElementDrawn(Element element, GameTime time, SpriteBatch batch, float alpha) {
this.OnElementDrawn?.Invoke(element, time, batch, alpha); this.OnElementDrawn?.Invoke(element, time, batch, alpha);
} }