1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 22:22:56 +08:00

Remove DragLayer dependency on MaskContainer

This commit is contained in:
Dean Herbert 2018-04-04 18:20:32 +09:00
parent c2d371797e
commit b6b8c51657
2 changed files with 6 additions and 7 deletions

View File

@ -18,23 +18,22 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// </summary>
public class DragLayer : CompositeDrawable
{
private readonly Action<RectangleF> performSelection;
/// <summary>
/// Invoked when the drag selection has finished.
/// </summary>
public event Action DragEnd;
private readonly MaskContainer maskContainer;
private Drawable box;
/// <summary>
/// Creates a new <see cref="DragLayer"/>.
/// </summary>
/// <param name="maskContainer">The selectable <see cref="HitObjectMask"/>s.</param>
public DragLayer(MaskContainer maskContainer)
public DragLayer(Action<RectangleF> performSelection)
{
this.maskContainer = maskContainer;
this.performSelection = performSelection;
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
Alpha = 0;
@ -78,7 +77,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
box.Position = topLeft;
box.Size = bottomRight - topLeft;
maskContainer.Select(dragRectangle);
performSelection?.Invoke(dragRectangle);
return true;
}

View File

@ -35,8 +35,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
selectionBox = composer.CreateSelectionBox(maskContainer);
var dragLayer = new DragLayer(maskContainer);
dragLayer.DragEnd += () => selectionBox.UpdateVisibility();
var dragLayer = new DragLayer(maskContainer.Select);
InternalChildren = new Drawable[]
{