Scroll progress and cleanup.

This commit is contained in:
Harrison Deng 2019-05-29 22:19:17 -05:00
parent c52283295a
commit 9b05f5aedb
2 changed files with 11 additions and 7 deletions

View File

@ -19,8 +19,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
Rectangle viewport;
UIModuleGroup group;
Color scrollBarColor;
float opacityOfBar = 1;
Color scrollBarColor = Color.White;
float opacityOfBar = 1f;
bool showingBars;
private bool mouseWasPressed;
private bool horizontalSelected;
@ -59,7 +59,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
value = Height - verticalScrollBarBounds.Height;
}
if (value < 0) value = 0;
shiftY = -(group.Height - viewport.Height) * (value/(Height - verticalScrollBarBounds.Height));
shiftY = -(group.Height - viewport.Height) * (value / (Height - verticalScrollBarBounds.Height));
HeightOrYChange(true);
}
}
@ -78,6 +78,10 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
ISpecialDrawable background, horizontalBarTrack, verticalBarTrack;
private int topPadding, bottomPadding, leftPadding, rightPadding;
/// <summary>
///
/// </summary>
public int PadTop { get { return topPadding; } set { topPadding = value; HeightOrYChange(); } }
public int PadBottom { get { return bottomPadding; } set { bottomPadding = value; HeightOrYChange(); } }
public int PadLeft { get { return leftPadding; } set { leftPadding = value; WidthOrXChange(); } }
@ -91,6 +95,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
public int HorizontalBarThickness { get { return horizontalScrollBarBounds.Height; } set { horizontalScrollBarBounds.Height = value; HeightOrYChange(); } }
public int VerticalBarThickness { get { return verticalScrollBarBounds.Width; } set { verticalScrollBarBounds.Width = value; WidthOrXChange(); } }
bool hideScrollBars;
/// <summary>
/// Whether or not to hide scroll bars.
/// </summary>
@ -105,11 +111,11 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
if (!value)
{
opacityOfBar = 1f;
scrollBarColor = color * opacityOfBar;
}
}
}
bool hideScrollBars = true;
/// <summary>
/// Set to true to change from the normal position to the new position.
@ -201,14 +207,13 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
if (opacityOfBar > 0f)
{
opacityOfBar -= (barFadeSpeed / 255f) * (float)gameTime.ElapsedGameTime.TotalSeconds;
scrollBarColor = color * opacityOfBar;
}
}
else
{
opacityOfBar = 1f;
scrollBarColor = color * opacityOfBar;
}
scrollBarColor = color * opacityOfBar;
}
if (horScrollAvailable)

View File

@ -64,7 +64,6 @@ namespace TestGame
uIScrollable = new UIScrollable(skin);
uIScrollable.Width = 256;
uIScrollable.Height = 256;
uIScrollable.HideScrollBars = true;
logoImage = new Image(logo);
uIScrollable.AddModules(logoImage);