Progress on scroll panel.
This commit is contained in:
parent
d5c898d081
commit
91e005ea00
@ -48,7 +48,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
/// <summary>
|
||||
/// The thickness of the scroll bars.
|
||||
/// </summary>
|
||||
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<UIScrollableSkinDefinition>().horizontalBar, true),
|
||||
skin.GetTextureAtlasRegion(skin.ObtainDefinition<UIScrollableSkinDefinition>().verticalBar, true),
|
||||
skin.GetTextureAtlasRegion(skin.ObtainDefinition<UIScrollableSkinDefinition>().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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user