Skip to content

Commit

Permalink
Merge pull request #26148 from rushiiMachine/resumeoverlay-min-cursor…
Browse files Browse the repository at this point in the history
…-size

Force minimum cursor size for `OsuResumeOverlay`
  • Loading branch information
peppy authored Dec 28, 2023
2 parents f5a3124 + c087578 commit c7f10db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ private void load()
};

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

protected override void LoadComplete()
{
base.LoadComplete();
calculateCursorScale();
cursorScale.Value = CalculateCursorScale();
}

private void calculateCursorScale()
protected virtual float CalculateCursorScale()
{
float scale = userCursorScale.Value;

Expand All @@ -94,7 +94,7 @@ private void calculateCursorScale()
scale *= GetScaleForCircleSize(state.Beatmap.Difficulty.CircleSize);
}

cursorScale.Value = scale;
return scale;
}

protected override void SkinChanged(ISkinSource skin)
Expand Down
6 changes: 6 additions & 0 deletions osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public OsuClickToResumeCursor()
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();
Expand Down

0 comments on commit c7f10db

Please sign in to comment.