mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-24 13:38:34 +01:00
Compare commits
2 commits
cf48fc372e
...
778d416774
Author | SHA1 | Date | |
---|---|---|---|
778d416774 | |||
543201d178 |
1 changed files with 22 additions and 19 deletions
|
@ -128,7 +128,7 @@ namespace MLEM.Ui.Elements {
|
|||
public override void ForceUpdateSortedChildren() {
|
||||
base.ForceUpdateSortedChildren();
|
||||
if (this.scrollOverflow)
|
||||
this.relevantChildrenDirty = true;
|
||||
this.ForceUpdateRelevantChildren();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -147,24 +147,8 @@ namespace MLEM.Ui.Elements {
|
|||
protected override IList<Element> GetRelevantChildren() {
|
||||
var relevant = base.GetRelevantChildren();
|
||||
if (this.scrollOverflow) {
|
||||
if (this.relevantChildrenDirty) {
|
||||
this.relevantChildrenDirty = false;
|
||||
|
||||
var visible = this.GetRenderTargetArea();
|
||||
this.relevantChildren.Clear();
|
||||
foreach (var child in this.SortedChildren) {
|
||||
if (child.Area.Intersects(visible)) {
|
||||
this.relevantChildren.Add(child);
|
||||
} else {
|
||||
foreach (var c in child.GetChildren(regardGrandchildren: true)) {
|
||||
if (c.Area.Intersects(visible)) {
|
||||
this.relevantChildren.Add(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.relevantChildrenDirty)
|
||||
this.ForceUpdateRelevantChildren();
|
||||
relevant = this.relevantChildren;
|
||||
}
|
||||
return relevant;
|
||||
|
@ -251,6 +235,7 @@ namespace MLEM.Ui.Elements {
|
|||
if (this.renderTarget != null)
|
||||
this.renderTarget.Dispose();
|
||||
this.renderTarget = targetArea.IsEmpty ? null : new RenderTarget2D(this.System.Game.GraphicsDevice, targetArea.Width, targetArea.Height);
|
||||
this.relevantChildrenDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,5 +257,23 @@ namespace MLEM.Ui.Elements {
|
|||
this.ScrollBar.PositionOffset = new Vector2(-this.ScrollerSize.Value.X - 1, 0);
|
||||
}
|
||||
|
||||
private void ForceUpdateRelevantChildren() {
|
||||
this.relevantChildrenDirty = false;
|
||||
this.relevantChildren.Clear();
|
||||
var visible = this.GetRenderTargetArea();
|
||||
foreach (var child in this.SortedChildren) {
|
||||
if (child.Area.Intersects(visible)) {
|
||||
this.relevantChildren.Add(child);
|
||||
} else {
|
||||
foreach (var c in child.GetChildren(regardGrandchildren: true)) {
|
||||
if (c.Area.Intersects(visible)) {
|
||||
this.relevantChildren.Add(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue