mirror of
https://github.com/osukey/osukey.git
synced 2025-06-10 05:48:05 +09:00
Use the same code path for all scaling
This commit is contained in:
parent
6a3c58b9ad
commit
14af86d6c5
@ -34,8 +34,6 @@ namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
adjustScaleFromAnchor(ref scale, anchor);
|
||||
|
||||
if (SelectedBlueprints.Count > 1)
|
||||
{
|
||||
var selectionQuad = GetSurroundingQuad(SelectedBlueprints.SelectMany(b =>
|
||||
b.Item.ScreenSpaceDrawQuad.GetVertices().ToArray()));
|
||||
|
||||
@ -76,8 +74,6 @@ namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
var drawableItem = (Drawable)b.Item;
|
||||
|
||||
if (SelectedBlueprints.Count > 1)
|
||||
{
|
||||
// each drawable's relative position should be maintained in the scaled quad.
|
||||
var screenPosition = b.ScreenSpaceSelectionPoint;
|
||||
|
||||
@ -95,33 +91,6 @@ namespace osu.Game.Skinning.Editor
|
||||
drawableItem.Position = drawableItem.Parent.ToLocalSpace(newPositionInAdjusted) - drawableItem.AnchorPosition;
|
||||
drawableItem.Scale += scaledDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var blueprint = SelectedBlueprints.First();
|
||||
var drawableItem = (Drawable)blueprint.Item;
|
||||
|
||||
// the number of local "pixels" the drag operation resulted in.
|
||||
// our goal is to increase the drawable's draw size by this amount.
|
||||
var scaledDelta = drawableItem.ScreenSpaceDeltaToParentSpace(scale);
|
||||
|
||||
scaledDelta = new Vector2(
|
||||
scaledDelta.X / drawableItem.DrawWidth,
|
||||
scaledDelta.Y / drawableItem.DrawHeight
|
||||
);
|
||||
|
||||
// handle the case where scaling with a centre origin needs double the adjustments to match
|
||||
// user cursor movement.
|
||||
if (drawableItem.Origin.HasFlagFast(Anchor.x1)) scaledDelta.X *= 2;
|
||||
if (drawableItem.Origin.HasFlagFast(Anchor.y1)) scaledDelta.Y *= 2;
|
||||
|
||||
// for now aspect lock scale adjustments that occur at corners.
|
||||
if (!anchor.HasFlagFast(Anchor.x1) && !anchor.HasFlagFast(Anchor.y1))
|
||||
scaledDelta.Y = scaledDelta.X;
|
||||
|
||||
drawableItem.Scale += scaledDelta;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user