1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Fix catch drawable objects not being clamped to playfield bounds

This commit is contained in:
Bartłomiej Dach 2023-12-27 10:55:29 +01:00
parent 8f7e0571f0
commit 2e8b49b93a
No known key found for this signature in database

View File

@ -1,10 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.UI;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -70,7 +72,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
private void updateXPosition(ValueChangedEvent<float> _) private void updateXPosition(ValueChangedEvent<float> _)
{ {
X = OriginalXBindable.Value + XOffsetBindable.Value; // same as `CatchHitObject.EffectiveX`.
// not using that property directly to support scenarios where `HitObject` may not necessarily be present
// for this pooled drawable.
X = Math.Clamp(OriginalXBindable.Value + XOffsetBindable.Value, 0, CatchPlayfield.WIDTH);
} }
protected override void OnApply() protected override void OnApply()