mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09: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)
|
foreach (var drawable in playfield.HitObjectContainer.AliveObjects)
|
||||||
{
|
{
|
||||||
float x = Math.Clamp(2 * drawable.X - cursorPos.X, 0, OsuPlayfield.BASE_SIZE.X);
|
var destination = Vector2.Clamp(2 * drawable.Position - cursorPos, Vector2.Zero, OsuPlayfield.BASE_SIZE);
|
||||||
float y = Math.Clamp(2 * drawable.Y - cursorPos.Y, 0, OsuPlayfield.BASE_SIZE.Y);
|
|
||||||
|
|
||||||
if (drawable.HitObject is Slider thisSlider)
|
if (drawable.HitObject is Slider thisSlider)
|
||||||
{
|
{
|
||||||
var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(thisSlider);
|
var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(thisSlider);
|
||||||
|
|
||||||
x = possibleMovementBounds.Width < 0
|
destination = Vector2.Clamp(
|
||||||
? x
|
destination,
|
||||||
: Math.Clamp(x, possibleMovementBounds.Left, possibleMovementBounds.Right);
|
new Vector2(possibleMovementBounds.Left, possibleMovementBounds.Top),
|
||||||
|
new Vector2(possibleMovementBounds.Right, possibleMovementBounds.Bottom)
|
||||||
y = possibleMovementBounds.Height < 0
|
);
|
||||||
? y
|
|
||||||
: Math.Clamp(y, possibleMovementBounds.Top, possibleMovementBounds.Bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var destination = new Vector2(x, y);
|
|
||||||
|
|
||||||
switch (drawable)
|
switch (drawable)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user