diff --git a/RecrownedAthenaeum/UI/Modular/Modules/UIScrollable.cs b/RecrownedAthenaeum/UI/Modular/Modules/UIScrollable.cs
index 4462393..2bbbb85 100644
--- a/RecrownedAthenaeum/UI/Modular/Modules/UIScrollable.cs
+++ b/RecrownedAthenaeum/UI/Modular/Modules/UIScrollable.cs
@@ -48,7 +48,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
///
/// The thickness of the scroll bars.
///
- int horizontalBarThickness, verticalBarThickness;
+ int horizontalBarThickness = 8, verticalBarThickness = 8;
public int HorizontalBarThickness { get { return horizontalBarThickness; } set { horizontalBarThickness = value; HeightOrYChange(); } }
public int VerticalBarThickness { get { return verticalBarThickness; } set { verticalBarThickness = value; WidthOrXChange(); } }
@@ -135,9 +135,11 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
this.background = background;
group = new UIModuleGroup(new BasicScissor());
+ HeightOrYChange();
+ WidthOrXChange();
}
- public UIScrollable(ISkin skin, string definition) :
+ public UIScrollable(ISkin skin, string definition = null) :
this(skin.GetTextureAtlasRegion(skin.ObtainDefinition().horizontalBar, true),
skin.GetTextureAtlasRegion(skin.ObtainDefinition().verticalBar, true),
skin.GetTextureAtlasRegion(skin.ObtainDefinition().horizontalBarTrack),
@@ -178,7 +180,10 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
public override void Draw(ConsistentSpriteBatch spriteBatch)
{
- background.Draw(spriteBatch, Boundaries, color, origin: origin);
+ background?.Draw(spriteBatch, Boundaries, color, origin: origin);
+
+ group.Draw(spriteBatch);
+
if (horScrollAvailable)
{
horizontalScrollBar.Draw(spriteBatch, horizontalScrollBarBounds, color);
@@ -210,6 +215,9 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
furthestY = mFurthestY;
}
}
+
+ WidthOrXChange();
+ HeightOrYChange();
}
public void RemoveModule(UIModule module)
@@ -285,7 +293,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
group.Height = Height - bottomPadding - topPadding;
if (Height < furthestY)
{
- horScrollAvailable = true;
+ vertScrollAvailable = true;
verticalScrollBarBounds.Height = (int)(Height * ((float)Height / furthestY));
verticalScrollBarBounds.Height = Math.Max(verticalScrollBarBounds.Height, minimumBarLength);
}
diff --git a/RecrownedAthenaeum/UI/SkinSystem/Definitions/UIScrollableSkinDefinition.cs b/RecrownedAthenaeum/UI/SkinSystem/Definitions/UIScrollableSkinDefinition.cs
index ee56c5a..c93c16f 100644
--- a/RecrownedAthenaeum/UI/SkinSystem/Definitions/UIScrollableSkinDefinition.cs
+++ b/RecrownedAthenaeum/UI/SkinSystem/Definitions/UIScrollableSkinDefinition.cs
@@ -1,4 +1,5 @@
-using System;
+using RecrownedAthenaeum.UI.Modular.Modules;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -25,6 +26,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
{
this.horizontalBar = horizontalBar;
this.verticalBar = verticalBar;
+ UIModuleType = typeof(UIScrollable);
}
}
}