Fix incorrect shear masking on nested textbox

This commit is contained in:
Dean Herbert 2022-05-03 14:45:17 +09:00
parent bc88c4ee8e
commit b5ea26f2fa
1 changed files with 7 additions and 24 deletions

View File

@ -21,7 +21,6 @@ public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue<string>
private const float corner_radius = 7;
private readonly Box background;
private readonly Box searchBoxBackground;
private readonly SearchTextBox textBox;
public Bindable<string> Current
@ -60,30 +59,12 @@ public ShearedSearchTextBox()
{
new Drawable[]
{
new Container
textBox = new InnerSearchTextBox
{
Name = @"Search box container",
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
Children = new Drawable[]
{
searchBoxBackground = new Box
{
RelativeSizeAxes = Axes.Both
},
textBox = new InnerSearchTextBox
{
Shear = -Shear,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{
Horizontal = corner_radius + Shear.X
}
}
}
Size = Vector2.One
},
new Container
{
@ -119,7 +100,6 @@ public ShearedSearchTextBox()
private void load(OverlayColourProvider colourProvider)
{
background.Colour = colourProvider.Background3;
searchBoxBackground.Colour = colourProvider.Background4;
}
public override bool HandleNonPositionalInput => textBox.HandleNonPositionalInput;
@ -134,6 +114,9 @@ private void load(OverlayColourProvider colourProvider)
Placeholder.Font = OsuFont.GetFont(size: CalculatedTextSize, weight: FontWeight.SemiBold);
PlaceholderText = CommonStrings.InputSearch;
CornerRadius = corner_radius;
TextContainer.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0);
}
protected override SpriteText CreatePlaceholder() => new SearchPlaceholder();