diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs
index 85e86499be..2f4721f63e 100644
--- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -93,6 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
}
+ private Container dragHandles;
private FillFlowContainer buttons;
public const float BORDER_RADIUS = 3;
@@ -152,6 +152,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
},
}
},
+ dragHandles = new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ // ensures that the centres of all drag handles line up with the middle of the selection box border.
+ Padding = new MarginPadding(BORDER_RADIUS / 2)
+ },
buttons = new FillFlowContainer
{
Y = 20,
@@ -233,30 +239,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
});
}
- private void addDragHandle(Anchor anchor) => AddInternal(new SelectionBoxDragHandle
+ private void addDragHandle(Anchor anchor) => dragHandles.Add(new SelectionBoxDragHandle
{
Anchor = anchor,
- X = dragCircleAdjustments[anchor].X,
- Y = dragCircleAdjustments[anchor].Y,
HandleDrag = e => OnScale?.Invoke(e.Delta, anchor),
OperationStarted = operationStarted,
OperationEnded = operationEnded
});
- ///
- /// Adjust Drag circle to be centered on the center of the border instead of on the edge.
- ///
- private Dictionary dragCircleAdjustments = new Dictionary(){
- {Anchor.TopLeft, new Vector2(BORDER_RADIUS / 2)},
- {Anchor.CentreLeft, new Vector2(BORDER_RADIUS / 2, 0)},
- {Anchor.BottomLeft, new Vector2(BORDER_RADIUS / 2, -BORDER_RADIUS / 2)},
- {Anchor.TopCentre, new Vector2(0, BORDER_RADIUS / 2)},
- {Anchor.BottomCentre, new Vector2(0, -BORDER_RADIUS / 2)},
- {Anchor.TopRight, new Vector2(-BORDER_RADIUS / 2, BORDER_RADIUS / 2)},
- {Anchor.CentreRight, new Vector2(-BORDER_RADIUS / 2, 0)},
- {Anchor.BottomRight, new Vector2(-BORDER_RADIUS / 2)}
- };
-
private int activeOperations;
private float convertDragEventToAngleOfRotation(DragEvent e)