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:
parent
c2d371797e
commit
b6b8c51657
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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[]
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user