mirror of https://github.com/ppy/osu
operate on vectors instead of vector components
This commit is contained in:
parent
a17e18103f
commit
0281bf672c
|
@ -51,24 +51,19 @@ public void Update(Playfield playfield)
|
|||
|
||||
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