mirror of
https://github.com/ppy/osu
synced 2024-12-13 02:17:32 +00:00
Merge pull request #11162 from Grrum/selectionRotation
improve selection box rotation UX
This commit is contained in:
commit
2aecc12370
@ -191,7 +191,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Y = -separation,
|
Y = -separation,
|
||||||
HandleDrag = e => OnRotation?.Invoke(e.Delta.X),
|
HandleDrag = e => OnRotation?.Invoke(convertDragEventToAngleOfRotation(e)),
|
||||||
OperationStarted = operationStarted,
|
OperationStarted = operationStarted,
|
||||||
OperationEnded = operationEnded
|
OperationEnded = operationEnded
|
||||||
}
|
}
|
||||||
@ -242,6 +242,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private int activeOperations;
|
private int activeOperations;
|
||||||
|
|
||||||
|
private float convertDragEventToAngleOfRotation(DragEvent e)
|
||||||
|
{
|
||||||
|
// Adjust coordinate system to the center of SelectionBox
|
||||||
|
float startAngle = MathF.Atan2(e.LastMousePosition.Y - DrawHeight / 2, e.LastMousePosition.X - DrawWidth / 2);
|
||||||
|
float endAngle = MathF.Atan2(e.MousePosition.Y - DrawHeight / 2, e.MousePosition.X - DrawWidth / 2);
|
||||||
|
|
||||||
|
return (endAngle - startAngle) * 180 / MathF.PI;
|
||||||
|
}
|
||||||
|
|
||||||
private void operationEnded()
|
private void operationEnded()
|
||||||
{
|
{
|
||||||
if (--activeOperations == 0)
|
if (--activeOperations == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user