mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Merge pull request #10850 from nbvdkamp/clamp-editor-movement
Clamp selection movement instead of refusing to move on playfield borders
This commit is contained in:
commit
0ea75450d4
@ -207,11 +207,17 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
Quad quad = getSurroundingQuad(hitObjects);
|
Quad quad = getSurroundingQuad(hitObjects);
|
||||||
|
|
||||||
if (quad.TopLeft.X + delta.X < 0 ||
|
Vector2 newTopLeft = quad.TopLeft + delta;
|
||||||
quad.TopLeft.Y + delta.Y < 0 ||
|
if (newTopLeft.X < 0)
|
||||||
quad.BottomRight.X + delta.X > DrawWidth ||
|
delta.X -= newTopLeft.X;
|
||||||
quad.BottomRight.Y + delta.Y > DrawHeight)
|
if (newTopLeft.Y < 0)
|
||||||
return false;
|
delta.Y -= newTopLeft.Y;
|
||||||
|
|
||||||
|
Vector2 newBottomRight = quad.BottomRight + delta;
|
||||||
|
if (newBottomRight.X > DrawWidth)
|
||||||
|
delta.X -= newBottomRight.X - DrawWidth;
|
||||||
|
if (newBottomRight.Y > DrawHeight)
|
||||||
|
delta.Y -= newBottomRight.Y - DrawHeight;
|
||||||
|
|
||||||
foreach (var h in hitObjects)
|
foreach (var h in hitObjects)
|
||||||
h.Position += delta;
|
h.Position += delta;
|
||||||
|
Loading…
Reference in New Issue
Block a user