1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 01:39:23 +01:00

add the ability for elements to override the position that children will be auto-anchored to

This commit is contained in:
Ellpeck 2019-08-18 17:49:52 +02:00
parent a9593ccb74
commit 15b468bab4

View file

@ -275,7 +275,7 @@ namespace MLEM.Ui.Elements {
if (this.Anchor >= Anchor.AutoLeft) {
var previousChild = this.GetPreviousChild(false);
if (previousChild != null) {
var prevArea = previousChild.Area;
var prevArea = previousChild.GetAreaForAutoAnchors();
switch (this.Anchor) {
case Anchor.AutoLeft:
case Anchor.AutoCenter:
@ -325,6 +325,10 @@ namespace MLEM.Ui.Elements {
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Floor());
}
protected Rectangle GetAreaForAutoAnchors() {
return this.Area;
}
protected Element GetPreviousChild(bool hiddenAlso) {
if (this.Parent == null)
return null;