mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-24 21:48:35 +01:00
Compare commits
No commits in common. "778d416774e938e92b03de8607e04a1e61b334be" and "cf48fc372e6fec17922cf6705fbe2f3a0ad5961b" have entirely different histories.
778d416774
...
cf48fc372e
1 changed files with 19 additions and 22 deletions
|
@ -128,7 +128,7 @@ namespace MLEM.Ui.Elements {
|
||||||
public override void ForceUpdateSortedChildren() {
|
public override void ForceUpdateSortedChildren() {
|
||||||
base.ForceUpdateSortedChildren();
|
base.ForceUpdateSortedChildren();
|
||||||
if (this.scrollOverflow)
|
if (this.scrollOverflow)
|
||||||
this.ForceUpdateRelevantChildren();
|
this.relevantChildrenDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -147,8 +147,24 @@ namespace MLEM.Ui.Elements {
|
||||||
protected override IList<Element> GetRelevantChildren() {
|
protected override IList<Element> GetRelevantChildren() {
|
||||||
var relevant = base.GetRelevantChildren();
|
var relevant = base.GetRelevantChildren();
|
||||||
if (this.scrollOverflow) {
|
if (this.scrollOverflow) {
|
||||||
if (this.relevantChildrenDirty)
|
if (this.relevantChildrenDirty) {
|
||||||
this.ForceUpdateRelevantChildren();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
relevant = this.relevantChildren;
|
relevant = this.relevantChildren;
|
||||||
}
|
}
|
||||||
return relevant;
|
return relevant;
|
||||||
|
@ -235,7 +251,6 @@ namespace MLEM.Ui.Elements {
|
||||||
if (this.renderTarget != null)
|
if (this.renderTarget != null)
|
||||||
this.renderTarget.Dispose();
|
this.renderTarget.Dispose();
|
||||||
this.renderTarget = targetArea.IsEmpty ? null : new RenderTarget2D(this.System.Game.GraphicsDevice, targetArea.Width, targetArea.Height);
|
this.renderTarget = targetArea.IsEmpty ? null : new RenderTarget2D(this.System.Game.GraphicsDevice, targetArea.Width, targetArea.Height);
|
||||||
this.relevantChildrenDirty = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,23 +272,5 @@ namespace MLEM.Ui.Elements {
|
||||||
this.ScrollBar.PositionOffset = new Vector2(-this.ScrollerSize.Value.X - 1, 0);
|
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