more progress on scroll system.

This commit is contained in:
Harrison Deng 2019-04-12 21:46:12 -05:00
parent d578a24510
commit f82c6cb9e1

View File

@ -45,12 +45,9 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
/// The minimum bar length for the scroll bar. /// The minimum bar length for the scroll bar.
/// </summary> /// </summary>
public int minimumBarLength = 16; public int minimumBarLength = 16;
/// <summary>
/// The thickness of the scroll bars. public int HorizontalBarThickness { get { return horizontalScrollBarBounds.Height; } set { horizontalScrollBarBounds.Height = value; HeightOrYChange(); } }
/// </summary> public int VerticalBarThickness { get { return verticalScrollBarBounds.Width; } set { verticalScrollBarBounds.Width = value; WidthOrXChange(); } }
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(); } }
/// <summary> /// <summary>
/// Whether or not to hide scroll bars. /// Whether or not to hide scroll bars.
@ -135,8 +132,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
this.background = background; this.background = background;
group = new UIModuleGroup(new BasicScissor()); group = new UIModuleGroup(new BasicScissor());
HeightOrYChange(); HorizontalBarThickness = 12;
WidthOrXChange(); VerticalBarThickness = 12;
} }
public UIScrollable(ISkin skin, string definition = null) : public UIScrollable(ISkin skin, string definition = null) :
@ -275,12 +272,12 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
if (!hideScrollBars) if (!hideScrollBars)
{ {
if (verticalBarLeftPosition) verticalScrollBarBounds.X = X;
if (!verticalBarLeftPosition)
{ {
group.X += verticalBarThickness; verticalScrollBarBounds.X += group.Width;
group.Width -= verticalBarThickness;
} }
group.Height -= verticalBarThickness; group.Width -= VerticalBarThickness;
} }
} }
} }
@ -301,12 +298,16 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
if (!hideScrollBars) if (!hideScrollBars)
{ {
horizontalScrollBarBounds.Y = Y;
group.Height -= HorizontalBarThickness;
if (!horizontalBarTopPosition) if (!horizontalBarTopPosition)
{ {
group.Y += horizontalBarThickness; horizontalScrollBarBounds.Y += group.Height;
group.Height -= horizontalBarThickness; }
else
{
group.Y += horizontalScrollBarBounds.Height;
} }
group.Height -= horizontalBarThickness;
} }
} }
} }