Fix incorrect circle piece hitbox

Hitboxes of circle pieces in osu! have regressed with commit 8592335.
The reason for the regression was that hit detection was moved from
DrawableHitCircle itself to a newly-introduced private HitArea class
(now named HitReceptor).

As HitArea inherited from Drawable, it would return IsHovered == true
over its entire bounding box. This meant that the hit area could wrongly
pick up actions that are not within circle radius and make them into
hits.

To resolve, make HitReceptor a CompositeDrawable and set its corner
radius to match the circle piece. This fixes the invalid hitbox, as
IsHovered takes radius into account.
This commit is contained in:
Bartłomiej Dach 2020-03-06 21:21:20 +01:00
parent 491840b17d
commit 77fd748035

View File

@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public Drawable ProxiedLayer => ApproachCircle;
public class HitReceptor : Drawable, IKeyBindingHandler<OsuAction>
public class HitReceptor : CompositeDrawable, IKeyBindingHandler<OsuAction>
{
// IsHovered is used
public override bool HandlePositionalInput => true;
@ -185,6 +185,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
CornerRadius = OsuHitObject.OBJECT_RADIUS;
CornerExponent = 2;
}
public bool OnPressed(OsuAction action)