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