diff --git a/CHANGELOG.md b/CHANGELOG.md index 4584933..6368be1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,10 +34,11 @@ Removals ### MLEM.Ui Additions -- Added `AutoInlineCenter` and `AutoInlineBottom` anchors +- Added AutoInlineCenter and AutoInlineBottom anchors Fixes - Fixed images not updating their hidden state properly when the displayed texture changes +- Fixed AutoInline elements overflowing into their parent if it's taller Improvements - Increased Element area calculation recursion limit to 64 diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index 951464f..7e180e4 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -728,9 +728,11 @@ namespace MLEM.Ui.Elements { pos.Y += anchorElArea.Height - newSize.Y; } } else { - // all inline anchors act the same when overflowing into the next line pos.X = parentArea.X + this.ScaledOffset.X; - pos.Y = anchorElArea.Bottom + this.ScaledOffset.Y; + // inline anchors that overflow into the next line act like AutoLeft + var newlineAnchorEl = this.GetLowestOlderSibling(e => !e.IsHidden && e.CanAutoAnchorsAttach); + if (newlineAnchorEl != null) + pos.Y = newlineAnchorEl.GetAreaForAutoAnchors().Bottom + this.ScaledOffset.Y; } } } else {