mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
inline anchors should use the old system though
This commit is contained in:
parent
df59ae7260
commit
00842d9e5f
1 changed files with 20 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue