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

Clean up nested class implementations

This commit is contained in:
Dean Herbert 2020-01-22 15:42:49 +09:00
parent 482409e776
commit c4395b1cea

View File

@ -36,33 +36,32 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
protected override SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }; protected override SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
protected class TimelineSelectionBlueprintContainer : SelectionBlueprintContainer
{
protected override Container<SelectionBlueprint> Content { get; }
public TimelineSelectionBlueprintContainer()
{
AddInternal(new TimelinePart<SelectionBlueprint>(Content = new Container<SelectionBlueprint> { RelativeSizeAxes = Axes.Both }) { RelativeSizeAxes = Axes.Both });
}
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
DragBox.Alpha = 0; DragBox.Alpha = 0;
} }
protected override SelectionBlueprint CreateBlueprintFor(HitObject hitObject) protected override bool OnDrag(DragEvent e)
{ {
//var yOffset = content.Count(d => d.X == h.StartTime); lastDragEvent = e;
//var yOffset = 0; return base.OnDrag(e);
return new TimelineHitObjectRepresentation(hitObject);
} }
protected override void Update()
{
if (IsDragged && lastDragEvent != null)
// trigger every frame so drags continue to update selection while playback is scrolling the timeline.
DragBox.UpdateDrag(lastDragEvent);
base.Update();
}
protected override SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => new TimelineHitObjectRepresentation(hitObject);
protected override DragBox CreateDragBox(Action<RectangleF> performSelect) => new CustomDragBox(performSelect); protected override DragBox CreateDragBox(Action<RectangleF> performSelect) => new CustomDragBox(performSelect);
internal class CustomDragBox : DragBox private class CustomDragBox : DragBox
{ {
public CustomDragBox(Action<RectangleF> performSelect) public CustomDragBox(Action<RectangleF> performSelect)
: base(performSelect) : base(performSelect)
@ -88,11 +87,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
} }
} }
protected class TimelineSelectionBlueprintContainer : SelectionBlueprintContainer
{
protected override Container<SelectionBlueprint> Content { get; }
public TimelineSelectionBlueprintContainer()
{
AddInternal(new TimelinePart<SelectionBlueprint>(Content = new Container<SelectionBlueprint> { RelativeSizeAxes = Axes.Both }) { RelativeSizeAxes = Axes.Both });
}
}
private class TimelineHitObjectRepresentation : SelectionBlueprint private class TimelineHitObjectRepresentation : SelectionBlueprint
{ {
private readonly Circle circle; private readonly Circle circle;
private Container extensionBar; private readonly Container extensionBar;
public const float THICKNESS = 3; public const float THICKNESS = 3;