1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Compare commits

..

No commits in common. "f35730ee7c7107f911bc771ffbc7c2aaf57f5fe2" and "3340a5024bc711d039c91b05e44b89e11e9d6391" have entirely different histories.

2 changed files with 4 additions and 15 deletions

View file

@ -18,9 +18,7 @@ Jump to version:
## 7.1.2 (In Development)
### MLEM.Ui
Additions
- Added Panel.IsVisible method to check if a child element is visible
No code changes
## 7.1.1

View file

@ -255,16 +255,6 @@ namespace MLEM.Ui.Elements {
this.ScrollBar.CurrentValue = this.ScrollBar.MaxValue;
}
/// <summary>
/// Returns whether the given <paramref name="element"/> is currently visible within this panel if it scrolls overflow.
/// This method will return <see langword="true"/> on any elements whose <see cref="Element.Area"/> intersects this panel's render target area, regardless of whether it is a child or grandchild of this panel.
/// </summary>
/// <param name="element">The element to query for visibility.</param>
/// <returns>Whether the element is in this panel's visible area.</returns>
public bool IsVisible(Element element) {
return element.Area.Intersects(this.GetRenderTargetArea());
}
/// <inheritdoc />
protected override void InitStyle(UiStyle style) {
base.InitStyle(style);
@ -379,12 +369,13 @@ namespace MLEM.Ui.Elements {
private void ForceUpdateRelevantChildren() {
this.relevantChildrenDirty = false;
this.relevantChildren.Clear();
var visible = this.GetRenderTargetArea();
foreach (var child in this.SortedChildren) {
if (this.IsVisible(child)) {
if (child.Area.Intersects(visible)) {
this.relevantChildren.Add(child);
} else {
foreach (var c in child.GetChildren(regardGrandchildren: true)) {
if (this.IsVisible(c)) {
if (c.Area.Intersects(visible)) {
this.relevantChildren.Add(child);
break;
}