1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 01:23:44 +08:00

Merge pull request #24097 from peppy/scrollbar-clickability

Increase the minimum size of the scroll bar
This commit is contained in:
Bartłomiej Dach 2023-07-01 18:17:48 +02:00 committed by GitHub
commit c3667aaa0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -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,
}); });

View File

@ -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)

View File

@ -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

View File

@ -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;