mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:13:18 +08:00
Split out common selection quad logic
This commit is contained in:
parent
27e81d6504
commit
95c78b9185
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -38,8 +39,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var selectionQuad = GetSurroundingQuad(SelectedBlueprints.SelectMany(b =>
|
var selectionQuad = getSelectionQuad();
|
||||||
b.Item.ScreenSpaceDrawQuad.GetVertices().ToArray()));
|
|
||||||
|
|
||||||
referenceOrigin ??= selectionQuad.Centre;
|
referenceOrigin ??= selectionQuad.Centre;
|
||||||
|
|
||||||
@ -63,8 +63,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
adjustScaleFromAnchor(ref scale, anchor);
|
adjustScaleFromAnchor(ref scale, anchor);
|
||||||
|
|
||||||
var selectionQuad = GetSurroundingQuad(SelectedBlueprints.SelectMany(b =>
|
var selectionQuad = getSelectionQuad();
|
||||||
b.Item.ScreenSpaceDrawQuad.GetVertices().ToArray()));
|
|
||||||
|
|
||||||
// the selection quad is always upright, so use a rect to make mutating the values easier.
|
// the selection quad is always upright, so use a rect to make mutating the values easier.
|
||||||
var adjustedRect = selectionQuad.AABBFloat;
|
var adjustedRect = selectionQuad.AABBFloat;
|
||||||
@ -220,6 +219,13 @@ namespace osu.Game.Skinning.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A screen-space quad surrounding all selected drawables, accounting for their full displayed size.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Quad getSelectionQuad() =>
|
||||||
|
GetSurroundingQuad(SelectedBlueprints.SelectMany(b => b.Item.ScreenSpaceDrawQuad.GetVertices().ToArray()));
|
||||||
|
|
||||||
private void applyAnchor(Anchor anchor)
|
private void applyAnchor(Anchor anchor)
|
||||||
{
|
{
|
||||||
foreach (var item in SelectedItems)
|
foreach (var item in SelectedItems)
|
||||||
|
Loading…
Reference in New Issue
Block a user