1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-14 12:47:21 +08:00

prevent flipping objects far offscreen

This commit is contained in:
OliBomby 2024-07-03 19:08:31 +02:00
parent 4165ded813
commit dfe6c70996

View File

@ -15,6 +15,7 @@ using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Utils;
using osuTK;
@ -119,6 +120,9 @@ namespace osu.Game.Rulesets.Osu.Edit
{
var flippedPosition = GeometryUtils.GetFlippedPosition(flipAxis, flipQuad, h.Position);
// Clamp the flipped position inside the playfield bounds, because the flipped position might be outside the playfield bounds if the origin is not centered.
flippedPosition = Vector2.Clamp(flippedPosition, Vector2.Zero, OsuPlayfield.BASE_SIZE);
if (!Precision.AlmostEquals(flippedPosition, h.Position))
{
h.Position = flippedPosition;