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 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 panels sometimes not drawing children that came into view when their positions changed unexpectedly
|
||||||
- Fixed UiMarkdownParser not parsing formatting in headings and blockquotes
|
- 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
|
### MLEM.Data
|
||||||
Improvements
|
Improvements
|
||||||
|
|
|
@ -407,11 +407,13 @@ namespace MLEM.Ui.Elements {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GamepadNextElementCallback GetGamepadNextElement;
|
public GamepadNextElementCallback GetGamepadNextElement;
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public OtherElementCallback OnChildAdded;
|
public OtherElementCallback OnChildAdded;
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public OtherElementCallback OnChildRemoved;
|
public OtherElementCallback OnChildRemoved;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -507,8 +509,8 @@ namespace MLEM.Ui.Elements {
|
||||||
e.System = this.System;
|
e.System = this.System;
|
||||||
e.OnAddedToUi?.Invoke(e);
|
e.OnAddedToUi?.Invoke(e);
|
||||||
this.Root?.InvokeOnElementAdded(e);
|
this.Root?.InvokeOnElementAdded(e);
|
||||||
this.OnChildAdded?.Invoke(this, e);
|
|
||||||
});
|
});
|
||||||
|
this.OnChildAdded?.Invoke(this, element);
|
||||||
this.SetSortedChildrenDirty();
|
this.SetSortedChildrenDirty();
|
||||||
element.SetAreaDirty();
|
element.SetAreaDirty();
|
||||||
return element;
|
return element;
|
||||||
|
@ -531,8 +533,8 @@ namespace MLEM.Ui.Elements {
|
||||||
e.System = null;
|
e.System = null;
|
||||||
e.OnRemovedFromUi?.Invoke(e);
|
e.OnRemovedFromUi?.Invoke(e);
|
||||||
this.Root?.InvokeOnElementRemoved(e);
|
this.Root?.InvokeOnElementRemoved(e);
|
||||||
this.OnChildRemoved?.Invoke(this, e);
|
|
||||||
});
|
});
|
||||||
|
this.OnChildRemoved?.Invoke(this, element);
|
||||||
this.SetSortedChildrenDirty();
|
this.SetSortedChildrenDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -572,7 +572,7 @@ namespace MLEM.Ui {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Element.GenericCallback OnElementAdded;
|
public event Element.GenericCallback OnElementAdded;
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public event Element.GenericCallback OnElementRemoved;
|
public event Element.GenericCallback OnElementRemoved;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue