mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 17:27:48 +08:00
Increase the minimum size of the scroll bar
Allows easier targetting when there is a lot of content in the scroll view As discussed in https://github.com/ppy/osu/discussions/24095#discussioncomment-6332398.
This commit is contained in:
parent
1f3d833b05
commit
5f880397a9
@ -188,7 +188,7 @@ namespace osu.Game.Collections
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
X = -OsuScrollContainer.SCROLL_BAR_HEIGHT,
|
X = -OsuScrollContainer.SCROLL_BAR_WIDTH,
|
||||||
Scale = new Vector2(0.65f),
|
Scale = new Vector2(0.65f),
|
||||||
Action = addOrRemove,
|
Action = addOrRemove,
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public partial class OsuScrollContainer<T> : ScrollContainer<T> where T : Drawable
|
public partial class OsuScrollContainer<T> : ScrollContainer<T> where T : Drawable
|
||||||
{
|
{
|
||||||
public const float SCROLL_BAR_HEIGHT = 10;
|
public const float SCROLL_BAR_WIDTH = 10;
|
||||||
public const float SCROLL_BAR_PADDING = 3;
|
public const float SCROLL_BAR_PADDING = 3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -139,6 +139,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private readonly Box box;
|
private readonly Box box;
|
||||||
|
|
||||||
|
protected override float MinimumDimSize => SCROLL_BAR_WIDTH * 3;
|
||||||
|
|
||||||
public OsuScrollbar(Direction scrollDir)
|
public OsuScrollbar(Direction scrollDir)
|
||||||
: base(scrollDir)
|
: base(scrollDir)
|
||||||
{
|
{
|
||||||
@ -147,7 +149,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
|
|
||||||
// needs to be set initially for the ResizeTo to respect minimum size
|
// needs to be set initially for the ResizeTo to respect minimum size
|
||||||
Size = new Vector2(SCROLL_BAR_HEIGHT);
|
Size = new Vector2(SCROLL_BAR_WIDTH);
|
||||||
|
|
||||||
const float margin = 3;
|
const float margin = 3;
|
||||||
|
|
||||||
@ -173,11 +175,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
|
public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
|
||||||
{
|
{
|
||||||
Vector2 size = new Vector2(SCROLL_BAR_HEIGHT)
|
this.ResizeTo(new Vector2(SCROLL_BAR_WIDTH)
|
||||||
{
|
{
|
||||||
[(int)ScrollDirection] = val
|
[(int)ScrollDirection] = val
|
||||||
};
|
}, duration, easing);
|
||||||
this.ResizeTo(size, duration, easing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays
|
|||||||
scrollbarBackground = new Box
|
scrollbarBackground = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = OsuScrollContainer.SCROLL_BAR_HEIGHT,
|
Width = OsuScrollContainer.SCROLL_BAR_WIDTH,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Alpha = 0.5f
|
Alpha = 0.5f
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
scroll.RelativeSizeAxes = Axes.X;
|
scroll.RelativeSizeAxes = Axes.X;
|
||||||
scroll.Height = ParticipantsList.TILE_SIZE + OsuScrollContainer.SCROLL_BAR_HEIGHT + OsuScrollContainer.SCROLL_BAR_PADDING * 2;
|
scroll.Height = ParticipantsList.TILE_SIZE + OsuScrollContainer.SCROLL_BAR_WIDTH + OsuScrollContainer.SCROLL_BAR_PADDING * 2;
|
||||||
|
|
||||||
list.RelativeSizeAxes = Axes.Y;
|
list.RelativeSizeAxes = Axes.Y;
|
||||||
list.AutoSizeAxes = Axes.X;
|
list.AutoSizeAxes = Axes.X;
|
||||||
|
Loading…
Reference in New Issue
Block a user