mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Ensure auto anchors keep their initial values if no siblings can be found (94a54c3
)
This commit is contained in:
parent
db454ebd71
commit
e0d4bb3472
1 changed files with 7 additions and 2 deletions
|
@ -672,6 +672,12 @@ namespace MLEM.Ui.Elements {
|
||||||
switch (this.anchor) {
|
switch (this.anchor) {
|
||||||
case Anchor.TopLeft:
|
case Anchor.TopLeft:
|
||||||
case Anchor.AutoLeft:
|
case Anchor.AutoLeft:
|
||||||
|
case Anchor.AutoInline:
|
||||||
|
case Anchor.AutoInlineCenter:
|
||||||
|
case Anchor.AutoInlineBottom:
|
||||||
|
case Anchor.AutoInlineIgnoreOverflow:
|
||||||
|
case Anchor.AutoInlineCenterIgnoreOverflow:
|
||||||
|
case Anchor.AutoInlineBottomIgnoreOverflow:
|
||||||
pos.X = parentArea.X + this.ScaledOffset.X;
|
pos.X = parentArea.X + this.ScaledOffset.X;
|
||||||
pos.Y = parentArea.Y + this.ScaledOffset.Y;
|
pos.Y = parentArea.Y + this.ScaledOffset.Y;
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +734,6 @@ namespace MLEM.Ui.Elements {
|
||||||
pos.Y += anchorElArea.Height - newSize.Y;
|
pos.Y += anchorElArea.Height - newSize.Y;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos.X = parentArea.X + this.ScaledOffset.X;
|
|
||||||
// inline anchors that overflow into the next line act like AutoLeft
|
// inline anchors that overflow into the next line act like AutoLeft
|
||||||
var newlineAnchorEl = this.GetLowestOlderSibling(e => !e.IsHidden && e.CanAutoAnchorsAttach);
|
var newlineAnchorEl = this.GetLowestOlderSibling(e => !e.IsHidden && e.CanAutoAnchorsAttach);
|
||||||
if (newlineAnchorEl != null)
|
if (newlineAnchorEl != null)
|
||||||
|
@ -736,7 +741,7 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// non-inline auto anchors keep their x coordinates from the switch above
|
// auto anchors keep their x coordinates from the switch above
|
||||||
var anchorEl = this.GetLowestOlderSibling(e => !e.IsHidden && e.CanAutoAnchorsAttach);
|
var anchorEl = this.GetLowestOlderSibling(e => !e.IsHidden && e.CanAutoAnchorsAttach);
|
||||||
if (anchorEl != null)
|
if (anchorEl != null)
|
||||||
pos.Y = anchorEl.GetAreaForAutoAnchors().Bottom + this.ScaledOffset.Y;
|
pos.Y = anchorEl.GetAreaForAutoAnchors().Bottom + this.ScaledOffset.Y;
|
||||||
|
|
Loading…
Reference in a new issue