mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 05:32:56 +08:00
Move selection logic to MaskContainer
This commit is contained in:
parent
d453c2589a
commit
4196bb8c24
@ -78,14 +78,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
box.Position = topLeft;
|
||||
box.Size = bottomRight - topLeft;
|
||||
|
||||
foreach (var mask in maskContainer.AliveMasks)
|
||||
{
|
||||
if (mask.IsPresent && dragRectangle.Contains(mask.SelectionPoint))
|
||||
mask.Select();
|
||||
else
|
||||
mask.Deselect();
|
||||
}
|
||||
|
||||
maskContainer.Select(dragRectangle);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
{
|
||||
@ -48,6 +49,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select all masks in a given rectangle selection area.
|
||||
/// </summary>
|
||||
/// <param name="rect">The rectangle to perform a selection on in screen-space coordinates.</param>
|
||||
public void Select(RectangleF rect)
|
||||
{
|
||||
foreach (var mask in AliveMasks)
|
||||
{
|
||||
if (mask.IsPresent && rect.Contains(mask.SelectionPoint))
|
||||
mask.Select();
|
||||
else
|
||||
mask.Deselect();
|
||||
}
|
||||
}
|
||||
|
||||
private void onMaskSelected(HitObjectMask mask) => MaskSelected?.Invoke(mask);
|
||||
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.Invoke(mask);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user