mirror of
https://github.com/ppy/osu
synced 2025-01-24 23:03:14 +00:00
Reorder methods in SkinSelectionHandler
to follow standards
This commit is contained in:
parent
a2faa0b74c
commit
51f4077b27
@ -17,6 +17,46 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
public class SkinSelectionHandler : SelectionHandler<ISkinnableComponent>
|
public class SkinSelectionHandler : SelectionHandler<ISkinnableComponent>
|
||||||
{
|
{
|
||||||
|
public override bool HandleRotation(float angle)
|
||||||
|
{
|
||||||
|
// TODO: this doesn't correctly account for origin/anchor specs being different in a multi-selection.
|
||||||
|
foreach (var c in SelectedBlueprints)
|
||||||
|
((Drawable)c.Item).Rotation += angle;
|
||||||
|
|
||||||
|
return base.HandleRotation(angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HandleScale(Vector2 scale, Anchor anchor)
|
||||||
|
{
|
||||||
|
adjustScaleFromAnchor(ref scale, anchor);
|
||||||
|
|
||||||
|
foreach (var c in SelectedBlueprints)
|
||||||
|
((Drawable)c.Item).Scale += scale * 0.01f;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HandleMovement(MoveSelectionEvent<ISkinnableComponent> moveEvent)
|
||||||
|
{
|
||||||
|
foreach (var c in SelectedBlueprints)
|
||||||
|
{
|
||||||
|
Drawable drawable = (Drawable)c.Item;
|
||||||
|
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSelectionChanged()
|
||||||
|
{
|
||||||
|
base.OnSelectionChanged();
|
||||||
|
|
||||||
|
SelectionBox.CanRotate = true;
|
||||||
|
SelectionBox.CanScaleX = true;
|
||||||
|
SelectionBox.CanScaleY = true;
|
||||||
|
SelectionBox.CanReverse = false;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void DeleteItems(IEnumerable<ISkinnableComponent> items)
|
protected override void DeleteItems(IEnumerable<ISkinnableComponent> items)
|
||||||
{
|
{
|
||||||
foreach (var i in items)
|
foreach (var i in items)
|
||||||
@ -67,46 +107,6 @@ namespace osu.Game.Skinning.Editor
|
|||||||
((Drawable)item).Anchor = anchor;
|
((Drawable)item).Anchor = anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSelectionChanged()
|
|
||||||
{
|
|
||||||
base.OnSelectionChanged();
|
|
||||||
|
|
||||||
SelectionBox.CanRotate = true;
|
|
||||||
SelectionBox.CanScaleX = true;
|
|
||||||
SelectionBox.CanScaleY = true;
|
|
||||||
SelectionBox.CanReverse = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleRotation(float angle)
|
|
||||||
{
|
|
||||||
// TODO: this doesn't correctly account for origin/anchor specs being different in a multi-selection.
|
|
||||||
foreach (var c in SelectedBlueprints)
|
|
||||||
((Drawable)c.Item).Rotation += angle;
|
|
||||||
|
|
||||||
return base.HandleRotation(angle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleScale(Vector2 scale, Anchor anchor)
|
|
||||||
{
|
|
||||||
adjustScaleFromAnchor(ref scale, anchor);
|
|
||||||
|
|
||||||
foreach (var c in SelectedBlueprints)
|
|
||||||
((Drawable)c.Item).Scale += scale * 0.01f;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleMovement(MoveSelectionEvent<ISkinnableComponent> moveEvent)
|
|
||||||
{
|
|
||||||
foreach (var c in SelectedBlueprints)
|
|
||||||
{
|
|
||||||
Drawable drawable = (Drawable)c.Item;
|
|
||||||
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference)
|
private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference)
|
||||||
{
|
{
|
||||||
// cancel out scale in axes we don't care about (based on which drag handle was used).
|
// cancel out scale in axes we don't care about (based on which drag handle was used).
|
||||||
|
Loading…
Reference in New Issue
Block a user