mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 17:23:52 +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.Position = topLeft;
|
||||||
box.Size = bottomRight - topLeft;
|
box.Size = bottomRight - topLeft;
|
||||||
|
|
||||||
foreach (var mask in maskContainer.AliveMasks)
|
maskContainer.Select(dragRectangle);
|
||||||
{
|
|
||||||
if (mask.IsPresent && dragRectangle.Contains(mask.SelectionPoint))
|
|
||||||
mask.Select();
|
|
||||||
else
|
|
||||||
mask.Deselect();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
@ -48,6 +49,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
return result;
|
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 onMaskSelected(HitObjectMask mask) => MaskSelected?.Invoke(mask);
|
||||||
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.Invoke(mask);
|
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.Invoke(mask);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user