mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Merge pull request #3116 from AlFasGD/labelled-text-box-fixes
Apply certain fixes for labelled text box
This commit is contained in:
commit
8a68ec6462
@ -4,6 +4,7 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents;
|
using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -21,15 +22,18 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Child = new Container
|
||||||
{
|
{
|
||||||
new LabelledTextBox
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Padding = new MarginPadding { Left = 150, Right = 150 },
|
||||||
|
Child = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
LabelText = "Testing text",
|
LabelText = "Testing text",
|
||||||
PlaceholderText = "This is definitely working as intended",
|
PlaceholderText = "This is definitely working as intended",
|
||||||
Padding = new MarginPadding { Left = 150, Right = 150 }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
public class LabelledTextBox : CompositeDrawable
|
public class LabelledTextBox : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float label_container_width = 150;
|
private const float label_container_width = 150;
|
||||||
private const float outer_corner_radius = 15;
|
private const float corner_radius = 15;
|
||||||
private const float inner_corner_radius = 10;
|
|
||||||
private const float default_height = 40;
|
private const float default_height = 40;
|
||||||
private const float default_label_left_padding = 15;
|
private const float default_label_left_padding = 15;
|
||||||
private const float default_label_top_padding = 12;
|
private const float default_label_top_padding = 12;
|
||||||
@ -55,24 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
set => textBox.Text = value;
|
set => textBox.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarginPadding Padding
|
|
||||||
{
|
|
||||||
get => base.Padding;
|
|
||||||
set => base.Padding = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MarginPadding LabelPadding
|
|
||||||
{
|
|
||||||
get => label.Padding;
|
|
||||||
set => label.Padding = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MarginPadding TextBoxPadding
|
|
||||||
{
|
|
||||||
get => textBox.Padding;
|
|
||||||
set => textBox.Padding = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color4 LabelTextColour
|
public Color4 LabelTextColour
|
||||||
{
|
{
|
||||||
get => label.Colour;
|
get => label.Colour;
|
||||||
@ -93,13 +74,13 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = default_height;
|
Height = default_height;
|
||||||
CornerRadius = outer_corner_radius;
|
CornerRadius = corner_radius;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
InternalChild = new Container
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
CornerRadius = outer_corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -131,7 +112,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 1,
|
Height = 1,
|
||||||
CornerRadius = inner_corner_radius,
|
CornerRadius = corner_radius,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user