Update drag area display to match new design logic

This commit is contained in:
Dean Herbert 2021-04-13 18:58:51 +09:00
parent 109ee395bf
commit 495fdd8d65

View File

@ -202,7 +202,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public override Vector2 ScreenSpaceSelectionPoint => ScreenSpaceDrawQuad.TopLeft; public override Vector2 ScreenSpaceSelectionPoint => ScreenSpaceDrawQuad.TopLeft;
public class DragArea : Container public class DragArea : Circle
{ {
private readonly HitObject hitObject; private readonly HitObject hitObject;
@ -224,6 +224,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Origin = Anchor.Centre; Origin = Anchor.Centre;
RelativePositionAxes = Axes.X; RelativePositionAxes = Axes.X;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Colour = OsuColour.Gray(0.2f);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -234,6 +235,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
updateState();
FinishTransforms();
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
updateState(); updateState();
@ -265,7 +274,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void updateState() private void updateState()
{ {
Colour = IsHovered || hasMouseDown ? Color4.OrangeRed : Color4.White; if (hasMouseDown)
{
this.ScaleTo(0.7f, 200, Easing.OutQuint);
}
else if (IsHovered)
{
this.ScaleTo(0.8f, 200, Easing.OutQuint);
}
else
{
this.ScaleTo(0.6f, 200, Easing.OutQuint);
}
this.FadeTo(IsHovered || hasMouseDown ? 0.8f : 0.2f, 200, Easing.OutQuint);
} }
[Resolved] [Resolved]
@ -369,12 +391,16 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Colour = Color4.Black.Opacity(0.4f) Colour = Color4.Black.Opacity(0.4f)
}; };
const float fudge = 0.97f;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container new Container
{ {
Height = circle_size, RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = fudge,
Masking = true, Masking = true,
AlwaysPresent = true, AlwaysPresent = true,
EdgeEffect = effect, EdgeEffect = effect,
@ -394,8 +420,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}, },
new Box new Box
{ {
Height = circle_size, RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = fudge,
}, },
}; };
} }