mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 14:37:18 +08:00
Merge pull request #18356 from bdach/fix-sheared-button-borders
Fix appearance of sheared button borders after click
This commit is contained in:
commit
8f20e9c04c
@ -5,6 +5,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -68,6 +69,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private Colour4? lighterColour;
|
private Colour4? lighterColour;
|
||||||
private Colour4? textColour;
|
private Colour4? textColour;
|
||||||
|
|
||||||
|
private readonly Container backgroundLayer;
|
||||||
private readonly Box flashLayer;
|
private readonly Box flashLayer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -85,24 +87,35 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Height = 50;
|
Height = 50;
|
||||||
Padding = new MarginPadding { Horizontal = shear * 50 };
|
Padding = new MarginPadding { Horizontal = shear * 50 };
|
||||||
|
|
||||||
Content.CornerRadius = 7;
|
const float corner_radius = 7;
|
||||||
|
|
||||||
|
Content.CornerRadius = corner_radius;
|
||||||
Content.Shear = new Vector2(shear, 0);
|
Content.Shear = new Vector2(shear, 0);
|
||||||
Content.Masking = true;
|
Content.Masking = true;
|
||||||
Content.BorderThickness = 2;
|
|
||||||
Content.Anchor = Content.Origin = Anchor.Centre;
|
Content.Anchor = Content.Origin = Anchor.Centre;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
backgroundLayer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
CornerRadius = corner_radius,
|
||||||
text = new OsuSpriteText
|
Masking = true,
|
||||||
{
|
BorderThickness = 2,
|
||||||
Anchor = Anchor.Centre,
|
Children = new Drawable[]
|
||||||
Origin = Anchor.Centre,
|
{
|
||||||
Font = OsuFont.TorusAlternate.With(size: 17),
|
background = new Box
|
||||||
Shear = new Vector2(-shear, 0)
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Font = OsuFont.TorusAlternate.With(size: 17),
|
||||||
|
Shear = new Vector2(-shear, 0)
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
flashLayer = new Box
|
flashLayer = new Box
|
||||||
{
|
{
|
||||||
@ -186,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
background.FadeColour(colourDark, 150, Easing.OutQuint);
|
background.FadeColour(colourDark, 150, Easing.OutQuint);
|
||||||
Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint);
|
backgroundLayer.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint);
|
||||||
|
|
||||||
if (!Enabled.Value)
|
if (!Enabled.Value)
|
||||||
colourText = colourText.Opacity(0.6f);
|
colourText = colourText.Opacity(0.6f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user