mirror of
https://github.com/ppy/osu
synced 2025-01-04 05:12:10 +00:00
Merge pull request #12650 from frenzibyte/selection-box-use-aabb
Compute selection box area using the bounding box of the blueprints instead
This commit is contained in:
commit
a8db63498a
@ -9,6 +9,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -327,20 +328,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Move the rectangle to cover the items
|
// Move the rectangle to cover the items
|
||||||
var topLeft = new Vector2(float.MaxValue, float.MaxValue);
|
RectangleF selectionRect = ToLocalSpace(selectedBlueprints[0].SelectionQuad).AABBFloat;
|
||||||
var bottomRight = new Vector2(float.MinValue, float.MinValue);
|
|
||||||
|
|
||||||
foreach (var blueprint in selectedBlueprints)
|
for (int i = 1; i < selectedBlueprints.Count; i++)
|
||||||
{
|
selectionRect = RectangleF.Union(selectionRect, ToLocalSpace(selectedBlueprints[i].SelectionQuad).AABBFloat);
|
||||||
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(blueprint.SelectionQuad.TopLeft));
|
|
||||||
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(blueprint.SelectionQuad.BottomRight));
|
|
||||||
}
|
|
||||||
|
|
||||||
topLeft -= new Vector2(5);
|
selectionRect = selectionRect.Inflate(5f);
|
||||||
bottomRight += new Vector2(5);
|
|
||||||
|
|
||||||
content.Size = bottomRight - topLeft;
|
content.Position = selectionRect.Location;
|
||||||
content.Position = topLeft;
|
content.Size = selectionRect.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user