1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-04 02:03:00 +08:00

Remove animated capture boxes for now

This commit is contained in:
smoogipoo 2018-02-15 18:06:33 +09:00
parent 115484741d
commit dcbc8c3dcd
3 changed files with 11 additions and 60 deletions

View File

@ -15,22 +15,12 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
/// <summary>
/// A box which encloses <see cref="DrawableHitObject"/>s.
/// </summary>
public abstract class CaptureBox : VisibilityContainer
public class CaptureBox : VisibilityContainer
{
/// <summary>
/// Top-left corner of the rectangle that encloses the <see cref="DrawableHitObject"/>s.
/// </summary>
protected Vector2 FinalPosition { get; private set; }
/// <summary>
/// Size of the rectangle that encloses the <see cref="DrawableHitObject"/>s.
/// </summary>
protected Vector2 FinalSize { get; private set; }
private readonly IDrawable captureArea;
private readonly IReadOnlyList<DrawableHitObject> capturedObjects;
protected CaptureBox(IDrawable captureArea, IReadOnlyList<DrawableHitObject> capturedObjects)
public CaptureBox(IDrawable captureArea, IReadOnlyList<DrawableHitObject> 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();
}
/// <summary>
/// A <see cref="CaptureBox"/> which fully encloses the <see cref="DrawableHitObject"/>s from the start.
/// </summary>
public class InstantCaptureBox : CaptureBox
{
public InstantCaptureBox(IDrawable captureArea, IReadOnlyList<DrawableHitObject> 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);
}
/// <summary>
/// A <see cref="CaptureBox"/> which moves from an initial position + size to enclose <see cref="DrawableHitObject"/>s.
/// </summary>
public class DragCaptureBox : CaptureBox
{
public DragCaptureBox(IDrawable captureArea, IReadOnlyList<DrawableHitObject> 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);
}
}

View File

@ -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();
}
}

View File

@ -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()));
}
}
}