mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 11:33:22 +08:00
Adjust breaks in timeline to be centered with waveform / hitobjects
This commit is contained in:
parent
2ad2ae0c16
commit
f65ab6736d
@ -29,11 +29,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
public Action<BreakPeriod>? OnDeleted { get; init; }
|
public Action<BreakPeriod>? OnDeleted { get; init; }
|
||||||
|
|
||||||
private Box background = null!;
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private OsuColour colours { get; set; } = null!;
|
|
||||||
|
|
||||||
public TimelineBreak(BreakPeriod b)
|
public TimelineBreak(BreakPeriod b)
|
||||||
{
|
{
|
||||||
Break.Value = b;
|
Break.Value = b;
|
||||||
@ -53,11 +48,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Horizontal = 5 },
|
Padding = new MarginPadding { Horizontal = 5 },
|
||||||
Child = background = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.Gray5,
|
Colour = colours.Gray5,
|
||||||
Alpha = 0.7f,
|
Alpha = 0.9f,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new DragHandle(isStartHandle: true)
|
new DragHandle(isStartHandle: true)
|
||||||
@ -88,23 +83,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
|
||||||
{
|
|
||||||
updateState();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
|
||||||
{
|
|
||||||
updateState();
|
|
||||||
base.OnHoverLost(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateState()
|
|
||||||
{
|
|
||||||
background.FadeColour(IsHovered ? colours.Gray6 : colours.Gray5, 400, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
{
|
{
|
||||||
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => OnDeleted?.Invoke(Break.Value)),
|
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => OnDeleted?.Invoke(Break.Value)),
|
||||||
@ -159,7 +137,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Anchor = Anchor,
|
Anchor = Anchor,
|
||||||
Origin = Anchor,
|
Origin = Anchor,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
CornerRadius = 5,
|
CornerRadius = 4,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
@ -249,8 +227,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
if (active)
|
if (active)
|
||||||
colour = colour.Lighten(0.3f);
|
colour = colour.Lighten(0.3f);
|
||||||
|
|
||||||
this.FadeColour(colour, 400, Easing.OutQuint);
|
handle.FadeColour(colour, 400, Easing.OutQuint);
|
||||||
handle.ResizeWidthTo(active ? 20 : 10, 400, Easing.OutElasticHalf);
|
handle.ResizeWidthTo(active ? 10 : 8, 400, Easing.OutElasticHalf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,13 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TimelineBlueprintContainer(composer),
|
new TimelineBlueprintContainer(composer),
|
||||||
new TimelineBreakDisplay { RelativeSizeAxes = Axes.Both, },
|
new TimelineBreakDisplay
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Height = 0.75f,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user