diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index b4c411b..12fa24f 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -43,6 +43,10 @@ namespace MLEM.Ui.Elements { /// The scroller size's height specified here is the minimum height, otherwise, it is automatically calculated based on panel content. /// public StyleProp ScrollerSize; + /// + /// The amount of pixels of room there should be between the and the rest of the content + /// + public StyleProp ScrollBarOffset; private readonly List relevantChildren = new List(); private readonly bool scrollOverflow; @@ -74,7 +78,7 @@ namespace MLEM.Ui.Elements { }; if (autoHideScrollbar) { this.ScrollBar.OnAutoHide += e => { - this.ChildPadding += new Padding(0, this.ScrollerSize.Value.X, 0, 0) * (e.IsHidden ? -1 : 1); + this.ChildPadding += new Padding(0, this.ScrollerSize.Value.X + this.ScrollBarOffset, 0, 0) * (e.IsHidden ? -1 : 1); this.SetAreaDirty(); }; } @@ -209,6 +213,7 @@ namespace MLEM.Ui.Elements { this.StepPerScroll.SetFromStyle(style.PanelStepPerScroll); this.ScrollerSize.SetFromStyle(style.PanelScrollerSize); this.ChildPadding.SetFromStyle(style.PanelChildPadding); + this.ScrollBarOffset.SetFromStyle(style.PanelScrollBarOffset); this.SetScrollBarStyle(); } @@ -264,7 +269,7 @@ namespace MLEM.Ui.Elements { return; this.ScrollBar.StepPerScroll = this.StepPerScroll; this.ScrollBar.Size = new Vector2(this.ScrollerSize.Value.X, 1); - this.ScrollBar.PositionOffset = new Vector2(-this.ScrollerSize.Value.X - 1, 0); + this.ScrollBar.PositionOffset = new Vector2(-this.ScrollerSize.Value.X - this.ScrollBarOffset, 0); } private void ForceUpdateRelevantChildren() { diff --git a/MLEM.Ui/Style/UiStyle.cs b/MLEM.Ui/Style/UiStyle.cs index 47d9acb..7f17370 100644 --- a/MLEM.Ui/Style/UiStyle.cs +++ b/MLEM.Ui/Style/UiStyle.cs @@ -11,7 +11,7 @@ namespace MLEM.Ui.Style { /// /// The style settings for a . /// Each uses these style settings by default, however you can also change these settings per element using the elements' individual style settings. - /// Note that this class is a , meaning additional styles for custom components can easily be added using + /// Note that this class is a , meaning additional styles for custom components can easily be added using /// public class UiStyle : GenericDataHolder { @@ -57,6 +57,10 @@ namespace MLEM.Ui.Style { /// public Vector2 PanelScrollerSize = new Vector2(5, 10); /// + /// The amount of pixels of room there should be between a 's scroll bar and the rest of its content + /// + public float PanelScrollBarOffset = 1; + /// /// The texture that the element uses /// public NinePatch TextFieldTexture;