Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute selection box area using the bounding box of the blueprints instead #12650

Merged
merged 3 commits into from
May 2, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
Expand Down Expand Up @@ -327,20 +328,15 @@ protected override void Update()
return;

// Move the rectangle to cover the items
var topLeft = new Vector2(float.MaxValue, float.MaxValue);
var bottomRight = new Vector2(float.MinValue, float.MinValue);
RectangleF selectionRect = ToLocalSpace(selectedBlueprints.First().SelectionQuad).AABBFloat;
frenzibyte marked this conversation as resolved.
Show resolved Hide resolved

foreach (var blueprint in selectedBlueprints)
{
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(blueprint.SelectionQuad.TopLeft));
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(blueprint.SelectionQuad.BottomRight));
}
foreach (var blueprint in selectedBlueprints.Skip(1))
frenzibyte marked this conversation as resolved.
Show resolved Hide resolved
selectionRect = RectangleF.Union(selectionRect, ToLocalSpace(blueprint.SelectionQuad).AABBFloat);

topLeft -= new Vector2(5);
bottomRight += new Vector2(5);
selectionRect = selectionRect.Inflate(5f);

content.Size = bottomRight - topLeft;
content.Position = topLeft;
content.Position = selectionRect.Location;
content.Size = selectionRect.Size;
}

#endregion
Expand Down