mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 11:22:57 +08:00
Align the drag circles on the selction box in the editor to be on the center of the border
This commit is contained in:
parent
bb586f3175
commit
a01ed1827a
@ -235,6 +235,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
private void addDragHandle(Anchor anchor) => AddInternal(new SelectionBoxDragHandle
|
private void addDragHandle(Anchor anchor) => AddInternal(new SelectionBoxDragHandle
|
||||||
{
|
{
|
||||||
Anchor = anchor,
|
Anchor = anchor,
|
||||||
|
Y = getAdjustmentToCenterCircleOnBorder(anchor).Y,
|
||||||
|
X = getAdjustmentToCenterCircleOnBorder(anchor).X,
|
||||||
HandleDrag = e => OnScale?.Invoke(e.Delta, anchor),
|
HandleDrag = e => OnScale?.Invoke(e.Delta, anchor),
|
||||||
OperationStarted = operationStarted,
|
OperationStarted = operationStarted,
|
||||||
OperationEnded = operationEnded
|
OperationEnded = operationEnded
|
||||||
@ -251,6 +253,45 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return (endAngle - startAngle) * 180 / MathF.PI;
|
return (endAngle - startAngle) * 180 / MathF.PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust Drag circle to be centered on the center of the border instead of on the edge.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="anchor">The part of the rectangle to be adjusted.</param>
|
||||||
|
private Vector2 getAdjustmentToCenterCircleOnBorder(Anchor anchor)
|
||||||
|
{
|
||||||
|
Vector2 adjustment = Vector2.Zero;
|
||||||
|
|
||||||
|
switch (anchor)
|
||||||
|
{
|
||||||
|
case Anchor.TopLeft:
|
||||||
|
case Anchor.CentreLeft:
|
||||||
|
case Anchor.BottomLeft:
|
||||||
|
adjustment.X = BORDER_RADIUS / 2;
|
||||||
|
break;
|
||||||
|
case Anchor.TopRight:
|
||||||
|
case Anchor.CentreRight:
|
||||||
|
case Anchor.BottomRight:
|
||||||
|
adjustment.X = -BORDER_RADIUS / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (anchor)
|
||||||
|
{
|
||||||
|
case Anchor.TopLeft:
|
||||||
|
case Anchor.TopCentre:
|
||||||
|
case Anchor.TopRight:
|
||||||
|
adjustment.Y = BORDER_RADIUS / 2;
|
||||||
|
break;
|
||||||
|
case Anchor.BottomLeft:
|
||||||
|
case Anchor.BottomCentre:
|
||||||
|
case Anchor.BottomRight:
|
||||||
|
adjustment.Y = -BORDER_RADIUS / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return adjustment;
|
||||||
|
}
|
||||||
|
|
||||||
private void operationEnded()
|
private void operationEnded()
|
||||||
{
|
{
|
||||||
if (--activeOperations == 0)
|
if (--activeOperations == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user