mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 14:38: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) {
|
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) {
|
if (previousChild != null) {
|
||||||
var prevArea = previousChild.GetAreaForAutoAnchors();
|
var prevArea = previousChild.GetAreaForAutoAnchors();
|
||||||
switch (this.Anchor) {
|
switch (this.Anchor) {
|
||||||
|
@ -334,21 +339,32 @@ namespace MLEM.Ui.Elements {
|
||||||
public Element GetLowestOlderSibling(bool hiddenAlso, bool unattachableAlso) {
|
public Element GetLowestOlderSibling(bool hiddenAlso, bool unattachableAlso) {
|
||||||
if (this.Parent == null)
|
if (this.Parent == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Element lowest = null;
|
Element lowest = null;
|
||||||
foreach (var child in this.Parent.Children) {
|
foreach (var child in this.Parent.Children) {
|
||||||
if (child == this)
|
if (child == this)
|
||||||
break;
|
break;
|
||||||
if (!hiddenAlso && child.IsHidden || !unattachableAlso && !child.CanAutoAnchorsAttach)
|
if (!hiddenAlso && child.IsHidden || !unattachableAlso && !child.CanAutoAnchorsAttach)
|
||||||
continue;
|
continue;
|
||||||
if (child.Anchor > Anchor.TopRight && child.Anchor < Anchor.AutoLeft)
|
|
||||||
continue;
|
|
||||||
if (lowest == null || child.Area.Bottom >= lowest.Area.Bottom)
|
if (lowest == null || child.Area.Bottom >= lowest.Area.Bottom)
|
||||||
lowest = child;
|
lowest = child;
|
||||||
}
|
}
|
||||||
return lowest;
|
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) {
|
public IEnumerable<Element> GetSiblings(bool hiddenAlso) {
|
||||||
if (this.Parent == null)
|
if (this.Parent == null)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
Loading…
Reference in a new issue