1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

inline anchors should use the old system though

This commit is contained in:
Ellpeck 2019-08-24 15:20:00 +02:00
parent df59ae7260
commit 00842d9e5f

View file

@ -263,7 +263,12 @@ namespace MLEM.Ui.Elements {
}
if (this.Anchor >= Anchor.AutoLeft) {
var previousChild = this.GetLowestOlderSibling(false, false);
Element previousChild;
if (this.Anchor == Anchor.AutoInline || this.Anchor == Anchor.AutoInlineIgnoreOverflow) {
previousChild = this.GetOlderSibling(false, false);
} else {
previousChild = this.GetLowestOlderSibling(false, false);
}
if (previousChild != null) {
var prevArea = previousChild.GetAreaForAutoAnchors();
switch (this.Anchor) {
@ -334,21 +339,32 @@ namespace MLEM.Ui.Elements {
public Element GetLowestOlderSibling(bool hiddenAlso, bool unattachableAlso) {
if (this.Parent == null)
return null;
Element lowest = null;
foreach (var child in this.Parent.Children) {
if (child == this)
break;
if (!hiddenAlso && child.IsHidden || !unattachableAlso && !child.CanAutoAnchorsAttach)
continue;
if (child.Anchor > Anchor.TopRight && child.Anchor < Anchor.AutoLeft)
continue;
if (lowest == null || child.Area.Bottom >= lowest.Area.Bottom)
lowest = child;
}
return lowest;
}
public Element GetOlderSibling(bool hiddenAlso, bool unattachableAlso) {
if (this.Parent == null)
return null;
Element older = null;
foreach (var child in this.Parent.Children) {
if (child == this)
break;
if (!hiddenAlso && child.IsHidden || !unattachableAlso && !child.CanAutoAnchorsAttach)
continue;
older = child;
}
return older;
}
public IEnumerable<Element> GetSiblings(bool hiddenAlso) {
if (this.Parent == null)
yield break;