Skip to content

Commit 1544358

Browse files
committed
Corrects placeholder rendering
- Ensures error text is displayed when available - Fixes background color blending on placeholders
1 parent 1cb1f39 commit 1544358

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

AuroraControlsMaui/PlatformUnderlayDrawable.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -693,25 +693,28 @@ private void DrawUnderlay(IUnderlayDrawable underlayDrawable, View element, Rect
693693
if (borderSize > 0d)
694694
{
695695
_placeholderPaint.TextSize = placeholderFontSize;
696-
var placeholderRectSize = canvas.GetTextContainerRectAt(isError ? underlayDrawable.ErrorText : placeholder, new SKPoint((float)controlXLeft, 0.0f), _placeholderPaint);
696+
var placeholderRectSize = canvas.GetTextContainerRectAt(isError && !string.IsNullOrEmpty(underlayDrawable.ErrorText) ? underlayDrawable.ErrorText : placeholder, new SKPoint((float)controlXLeft, 0.0f), _placeholderPaint);
697697

698698
canvas.DrawRoundRect(roundedRectBackgroundPlaceholderThrough, cornerRadiusSize, _borderPaint);
699699

700-
float bufferSize = 2f;
701-
float top = roundedRectBackgroundPlaceholderThrough.Top - (_borderPaint.StrokeWidth * .5f);
700+
if (hasValueAnimationPercentage > 0.0d)
701+
{
702+
float bufferSize = 2f;
703+
float top = roundedRectBackgroundPlaceholderThrough.Top - (_borderPaint.StrokeWidth * .5f);
702704

703-
var startingBlendMode = _backgroundPaint.BlendMode;
705+
var startingBlendMode = _backgroundPaint.BlendMode;
704706

705-
_backgroundPaint.BlendMode = SKBlendMode.SrcIn;
707+
_backgroundPaint.BlendMode = SKBlendMode.SrcIn;
706708

707-
_backgroundPaint.Color =
708-
_borderPaint.Color.Lerp(
709-
element.BackgroundColor?.ToSKColor() ?? SKColors.Transparent,
710-
hasValueAnimationPercentage);
709+
_backgroundPaint.Color =
710+
_borderPaint.Color.Lerp(
711+
element.BackgroundColor?.ToSKColor() ?? SKColors.Transparent,
712+
hasValueAnimationPercentage);
711713

712-
canvas.DrawRect(new SKRect(placeholderRectSize.Left - bufferSize, top, placeholderRectSize.Right + (bufferSize * 2f), top + placeholderRectSize.Height), _backgroundPaint);
714+
canvas.DrawRect(new SKRect(placeholderRectSize.Left - bufferSize, top, placeholderRectSize.Right + (bufferSize * 2f), top + placeholderRectSize.Height), _backgroundPaint);
713715

714-
_backgroundPaint.BlendMode = startingBlendMode;
716+
_backgroundPaint.BlendMode = startingBlendMode;
717+
}
715718
}
716719
}
717720

0 commit comments

Comments
 (0)