mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
allow panel children to be ordered arbitrarily rather than requiring the scroll bar in the first index
This commit is contained in:
parent
914761519f
commit
2d332c3a48
1 changed files with 3 additions and 2 deletions
|
@ -70,7 +70,8 @@ namespace MLEM.Ui.Elements {
|
||||||
return;
|
return;
|
||||||
if (otherElement == null || !otherElement.GetParentTree().Contains(this))
|
if (otherElement == null || !otherElement.GetParentTree().Contains(this))
|
||||||
return;
|
return;
|
||||||
this.ScrollBar.CurrentValue = (otherElement.Area.Bottom - this.Children[1].Area.Top - this.Area.Height / 2) / this.Scale;
|
var firstChild = this.Children.First(c => !(c is ScrollBar));
|
||||||
|
this.ScrollBar.CurrentValue = (otherElement.Area.Bottom - firstChild.Area.Top - this.Area.Height / 2) / this.Scale;
|
||||||
};
|
};
|
||||||
this.AddChild(this.ScrollBar);
|
this.AddChild(this.ScrollBar);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,7 @@ namespace MLEM.Ui.Elements {
|
||||||
if (this.Children.Count == 1)
|
if (this.Children.Count == 1)
|
||||||
return;
|
return;
|
||||||
// the "real" first child is the scroll bar, which we want to ignore
|
// the "real" first child is the scroll bar, which we want to ignore
|
||||||
var firstChild = this.Children[1];
|
var firstChild = this.Children.First(c => !(c is ScrollBar));
|
||||||
var lowestChild = this.GetLowestChild(e => !e.IsHidden);
|
var lowestChild = this.GetLowestChild(e => !e.IsHidden);
|
||||||
// the max value of the scrollbar is the amount of non-scaled pixels taken up by overflowing components
|
// the max value of the scrollbar is the amount of non-scaled pixels taken up by overflowing components
|
||||||
var childrenHeight = lowestChild.Area.Bottom - firstChild.Area.Top;
|
var childrenHeight = lowestChild.Area.Bottom - firstChild.Area.Top;
|
||||||
|
|
Loading…
Reference in a new issue