Merge pull request #26148 from rushiiMachine/resumeoverlay-min-cursor-size

Force minimum cursor size for `OsuResumeOverlay`
This commit is contained in:
Dean Herbert 2023-12-28 19:23:57 +09:00 committed by GitHub
commit c7f10dbc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -70,10 +70,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
};
userCursorScale = config.GetBindable<float>(OsuSetting.GameplayCursorSize);
userCursorScale.ValueChanged += _ => calculateCursorScale();
userCursorScale.ValueChanged += _ => cursorScale.Value = CalculateCursorScale();
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateCursorScale();
autoCursorScale.ValueChanged += _ => cursorScale.Value = CalculateCursorScale();
cursorScale.BindValueChanged(e => cursorScaleContainer.Scale = new Vector2(e.NewValue), true);
}
@ -81,10 +81,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override void LoadComplete()
{
base.LoadComplete();
calculateCursorScale();
cursorScale.Value = CalculateCursorScale();
}
private void calculateCursorScale()
protected virtual float CalculateCursorScale()
{
float scale = userCursorScale.Value;
@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= GetScaleForCircleSize(state.Beatmap.Difficulty.CircleSize);
}
cursorScale.Value = scale;
return scale;
}
protected override void SkinChanged(ISkinSource skin)

View File

@ -71,6 +71,12 @@ namespace osu.Game.Rulesets.Osu.UI
RelativePositionAxes = Axes.Both;
}
protected override float CalculateCursorScale()
{
// Force minimum cursor size so it's easily clickable
return Math.Max(1f, base.CalculateCursorScale());
}
protected override bool OnHover(HoverEvent e)
{
updateColour();