mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Fixed Element.OnChildAdded and Element.OnChildRemoved being called for grandchildren when a child is added
This commit is contained in:
parent
55735b4c64
commit
d0c805cf18
3 changed files with 8 additions and 5 deletions
|
@ -41,6 +41,7 @@ Fixes
|
|||
- Fixed paragraphs sometimes not updating their position properly when hidden because they're empty
|
||||
- Fixed panels sometimes not drawing children that came into view when their positions changed unexpectedly
|
||||
- Fixed UiMarkdownParser not parsing formatting in headings and blockquotes
|
||||
- Fixed Element.OnChildAdded and Element.OnChildRemoved being called for grandchildren when a child is added
|
||||
|
||||
### MLEM.Data
|
||||
Improvements
|
||||
|
|
|
@ -407,11 +407,13 @@ namespace MLEM.Ui.Elements {
|
|||
/// </summary>
|
||||
public GamepadNextElementCallback GetGamepadNextElement;
|
||||
/// <summary>
|
||||
/// Event that is called when a child or any level of grandchild is added to this element using <see cref="AddChild{T}"/>
|
||||
/// Event that is called when a child is added to this element using <see cref="AddChild{T}"/>
|
||||
/// Note that, while this event is only called for immediate children of this element, <see cref="RootElement.OnElementAdded"/> is called for all children and grandchildren.
|
||||
/// </summary>
|
||||
public OtherElementCallback OnChildAdded;
|
||||
/// <summary>
|
||||
/// Event that is called when a child or any level of grandchild is removed from this element using <see cref="RemoveChild"/>
|
||||
/// Event that is called when a child is removed from this element using <see cref="RemoveChild"/>.
|
||||
/// Note that, while this event is only called for immediate children of this element, <see cref="RootElement.OnElementRemoved"/> is called for all children and grandchildren.
|
||||
/// </summary>
|
||||
public OtherElementCallback OnChildRemoved;
|
||||
/// <summary>
|
||||
|
@ -507,8 +509,8 @@ namespace MLEM.Ui.Elements {
|
|||
e.System = this.System;
|
||||
e.OnAddedToUi?.Invoke(e);
|
||||
this.Root?.InvokeOnElementAdded(e);
|
||||
this.OnChildAdded?.Invoke(this, e);
|
||||
});
|
||||
this.OnChildAdded?.Invoke(this, element);
|
||||
this.SetSortedChildrenDirty();
|
||||
element.SetAreaDirty();
|
||||
return element;
|
||||
|
@ -531,8 +533,8 @@ namespace MLEM.Ui.Elements {
|
|||
e.System = null;
|
||||
e.OnRemovedFromUi?.Invoke(e);
|
||||
this.Root?.InvokeOnElementRemoved(e);
|
||||
this.OnChildRemoved?.Invoke(this, e);
|
||||
});
|
||||
this.OnChildRemoved?.Invoke(this, element);
|
||||
this.SetSortedChildrenDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ namespace MLEM.Ui {
|
|||
/// </summary>
|
||||
public event Element.GenericCallback OnElementAdded;
|
||||
/// <summary>
|
||||
/// Event that is invoked when a <see cref="Element"/> is removed rom this root element of any of its children.
|
||||
/// Event that is invoked when a <see cref="Element"/> is removed rom this root element or any of its children.
|
||||
/// </summary>
|
||||
public event Element.GenericCallback OnElementRemoved;
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue