mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
operate on vectors instead of vector components
This commit is contained in:
parent
a17e18103f
commit
0281bf672c
@ -51,24 +51,19 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
foreach (var drawable in playfield.HitObjectContainer.AliveObjects)
|
||||
{
|
||||
float x = Math.Clamp(2 * drawable.X - cursorPos.X, 0, OsuPlayfield.BASE_SIZE.X);
|
||||
float y = Math.Clamp(2 * drawable.Y - cursorPos.Y, 0, OsuPlayfield.BASE_SIZE.Y);
|
||||
var destination = Vector2.Clamp(2 * drawable.Position - cursorPos, Vector2.Zero, OsuPlayfield.BASE_SIZE);
|
||||
|
||||
if (drawable.HitObject is Slider thisSlider)
|
||||
{
|
||||
var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(thisSlider);
|
||||
|
||||
x = possibleMovementBounds.Width < 0
|
||||
? x
|
||||
: Math.Clamp(x, possibleMovementBounds.Left, possibleMovementBounds.Right);
|
||||
|
||||
y = possibleMovementBounds.Height < 0
|
||||
? y
|
||||
: Math.Clamp(y, possibleMovementBounds.Top, possibleMovementBounds.Bottom);
|
||||
destination = Vector2.Clamp(
|
||||
destination,
|
||||
new Vector2(possibleMovementBounds.Left, possibleMovementBounds.Top),
|
||||
new Vector2(possibleMovementBounds.Right, possibleMovementBounds.Bottom)
|
||||
);
|
||||
}
|
||||
|
||||
var destination = new Vector2(x, y);
|
||||
|
||||
switch (drawable)
|
||||
{
|
||||
case DrawableHitCircle circle:
|
||||
|
Loading…
Reference in New Issue
Block a user