mirror of
https://github.com/ppy/osu.git
synced 2025-01-16 01:42:58 +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>
|
/// </summary>
|
||||||
public class DragLayer : CompositeDrawable
|
public class DragLayer : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
private readonly Action<RectangleF> performSelection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when the drag selection has finished.
|
/// Invoked when the drag selection has finished.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action DragEnd;
|
public event Action DragEnd;
|
||||||
|
|
||||||
private readonly MaskContainer maskContainer;
|
|
||||||
|
|
||||||
private Drawable box;
|
private Drawable box;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="DragLayer"/>.
|
/// Creates a new <see cref="DragLayer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maskContainer">The selectable <see cref="HitObjectMask"/>s.</param>
|
/// <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;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
@ -78,7 +77,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
box.Position = topLeft;
|
box.Position = topLeft;
|
||||||
box.Size = bottomRight - topLeft;
|
box.Size = bottomRight - topLeft;
|
||||||
|
|
||||||
maskContainer.Select(dragRectangle);
|
performSelection?.Invoke(dragRectangle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
selectionBox = composer.CreateSelectionBox(maskContainer);
|
selectionBox = composer.CreateSelectionBox(maskContainer);
|
||||||
|
|
||||||
var dragLayer = new DragLayer(maskContainer);
|
|
||||||
dragLayer.DragEnd += () => selectionBox.UpdateVisibility();
|
dragLayer.DragEnd += () => selectionBox.UpdateVisibility();
|
||||||
|
var dragLayer = new DragLayer(maskContainer.Select);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user