diff --git a/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs b/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs index 86e96f6d84..35e425c981 100644 --- a/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs +++ b/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs @@ -15,22 +15,12 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection /// /// A box which encloses s. /// - public abstract class CaptureBox : VisibilityContainer + public class CaptureBox : VisibilityContainer { - /// - /// Top-left corner of the rectangle that encloses the s. - /// - protected Vector2 FinalPosition { get; private set; } - - /// - /// Size of the rectangle that encloses the s. - /// - protected Vector2 FinalSize { get; private set; } - private readonly IDrawable captureArea; private readonly IReadOnlyList capturedObjects; - protected CaptureBox(IDrawable captureArea, IReadOnlyList capturedObjects) + public CaptureBox(IDrawable captureArea, IReadOnlyList capturedObjects) { this.captureArea = captureArea; this.capturedObjects = capturedObjects; @@ -66,48 +56,12 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection topLeft -= new Vector2(5); bottomRight += new Vector2(5); - FinalSize = bottomRight - topLeft; - FinalPosition = topLeft; + Size = bottomRight - topLeft; + Position = topLeft; } - protected override void PopIn() => this.MoveTo(FinalPosition).ResizeTo(FinalSize).FadeIn(); + protected override void PopIn() => this.FadeIn(); + protected override void PopOut() => this.FadeOut(); } - - /// - /// A which fully encloses the s from the start. - /// - public class InstantCaptureBox : CaptureBox - { - public InstantCaptureBox(IDrawable captureArea, IReadOnlyList capturedObjects) - : base(captureArea, capturedObjects) - { - Origin = Anchor.Centre; - } - - protected override void PopIn() - => this.MoveTo(FinalPosition + FinalSize / 2f).ResizeTo(FinalSize).ScaleTo(1.1f) - .Then() - .ScaleTo(1f, 300, Easing.OutQuint).FadeIn(300, Easing.OutQuint); - - protected override void PopOut() => this.FadeOut(300, Easing.OutQuint); - } - - /// - /// A which moves from an initial position + size to enclose s. - /// - public class DragCaptureBox : CaptureBox - { - public DragCaptureBox(IDrawable captureArea, IReadOnlyList capturedObjects, Vector2 initialPosition, Vector2 initialSize) - : base(captureArea, capturedObjects) - { - Position = initialPosition; - Size = initialSize; - } - - protected override void PopIn() - => this.MoveTo(FinalPosition, 300, Easing.OutQuint).ResizeTo(FinalSize, 300, Easing.OutQuint).FadeIn(300, Easing.OutQuint); - - protected override void PopOut() => this.FadeOut(300, Easing.OutQuint); - } } diff --git a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs index 87c6833f01..8907993173 100644 --- a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs +++ b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs @@ -52,6 +52,6 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection Size = bottomRight - topLeft; } - public override void Hide() => this.FadeOut(400, Easing.OutQuint).Expire(); + public override void Hide() => this.FadeOut(250, Easing.OutQuint).Expire(); } } diff --git a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs index 0fceced040..f73820d534 100644 --- a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs +++ b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection protected override bool OnDragEnd(InputState state) { selectionBox.Hide(); - finishSelection(true); + finishSelection(); return true; } @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection protected override bool OnClick(InputState state) { selectPoint(state.Mouse.NativeState.Position); - finishSelection(false); + finishSelection(); return true; } @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection selectedHitObjects.Add(selected); } - private void finishSelection(bool fromDrag) + private void finishSelection() { if (selectedHitObjects.Count == 0) return; @@ -111,10 +111,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection // OnDragEnd and OnClick methods within a single frame, OnMouseDown doesn't help us here captureBox?.Hide(); - if (fromDrag) - AddInternal(captureBox = new DragCaptureBox(this, selectedHitObjects.ToList(), selectionBox.Position, selectionBox.Size)); - else - AddInternal(captureBox = new InstantCaptureBox(this, selectedHitObjects.ToList())); + AddInternal(captureBox = new CaptureBox(this, selectedHitObjects.ToList())); } } }