diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index a7b6925..85d1492 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -257,12 +257,12 @@ namespace MLEM.Ui.Elements { public bool CanAutoAnchorsAttach = true; /// /// Set this field to true to cause this element's width to be automatically calculated based on the area that its take up. - /// To use this element's 's X coordinate as a minimum width rather than ignoring it, set to true. + /// To use this element's 's X coordinate as a minimum or maximum width rather than ignoring it, set or to true. /// public bool SetWidthBasedOnChildren; /// /// Set this field to true to cause this element's height to be automatically calculated based on the area that its take up. - /// To use this element's 's Y coordinate as a minimum height rather than ignoring it, set to true. + /// To use this element's 's Y coordinate as a minimum or maximum height rather than ignoring it, set or to true. /// public bool SetHeightBasedOnChildren; /// @@ -272,6 +272,11 @@ namespace MLEM.Ui.Elements { /// public bool TreatSizeAsMinimum; /// + /// If this field is set to true, and or are enabled, the resulting width or height weill always be less than or equal to this element's . + /// Note that this value only has an effect if or are enabled. + /// + public bool TreatSizeAsMaximum; + /// /// Set this field to true to cause this element's final display area to never exceed that of its . /// If the resulting area is too large, the size of this element is shrunk to fit the target area. /// This can be useful if an element should fill the remaining area of a parent exactly. @@ -661,8 +666,12 @@ namespace MLEM.Ui.Elements { } } - if (this.TreatSizeAsMinimum) + if (this.TreatSizeAsMinimum) { autoSize = Vector2.Max(autoSize, actualSize); + } else if (this.TreatSizeAsMaximum) { + autoSize = Vector2.Min(autoSize, actualSize); + } + if (!autoSize.Equals(this.UnscrolledArea.Size, 0.01F)) { recursion++; if (recursion >= 16) {