Skip to content

Commit 0702083

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents feedc4e + 9ec268d commit 0702083

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

AuroraControls.TestApp/StyledInputLayoutTestPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
<aurora:StyledInputLayout
4747

4848
PlaceholderColor="Black"
49-
ActiveColor="Red"
50-
InactiveColor="Green"
49+
ActiveColor="Transparent"
50+
InactiveColor="Transparent"
5151
VerticalOptions="Start"
5252
BorderStyle="RoundedRectanglePlaceholderThrough">
5353
<Entry Placeholder="VerticalOptions=Start" />

AuroraControlsMaui/PlatformUnderlayDrawable.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,7 @@ private void DrawUnderlay(IUnderlayDrawable underlayDrawable, View element, Rect
560560
var internalMargin = underlayDrawable.InternalMargin;
561561

562562
float placeholderFontSize = underlayDrawable.ActivePlaceholderFontSize * scale;
563-
var placeholderColor =
564-
underlayDrawable.PlaceholderColor != default(Color)
565-
? underlayDrawable.PlaceholderColor
566-
: HavePlaceholderElement.DefaultPlaceholderColor;
563+
var placeholderColor = underlayDrawable.PlaceholderColor;
567564

568565
float fontSize = (float)underlayDrawable.FontSize * scale;
569566

@@ -722,26 +719,31 @@ private void DrawUnderlay(IUnderlayDrawable underlayDrawable, View element, Rect
722719
}
723720
else if (!string.IsNullOrEmpty(placeholder))
724721
{
725-
_placeholderPaint.Color =
726-
placeholderColor
727-
.Lerp(
728-
underlayDrawable.ActiveColor,
729-
focusAnimationPercentage > 0d ? focusAnimationPercentage : hasValueAnimationPercentage)
730-
.ToSKColor();
731-
732722
if (placeholderFontSize > 0d)
733723
{
734-
double placeholderY = controlYCenter.Lerp(focusedPlaceholderCenterY, hasValueAnimationPercentage);
724+
var currentColor = isFocused ? underlayDrawable.ActiveColor : underlayDrawable.InactiveColor;
725+
726+
if (currentColor.Alpha > 0.0f)
727+
{
728+
_placeholderPaint.Color =
729+
placeholderColor
730+
.Lerp(
731+
currentColor,
732+
focusAnimationPercentage > 0d ? focusAnimationPercentage : hasValueAnimationPercentage)
733+
.ToSKColor();
735734

736-
_placeholderPaint.TextSize = fontSize.Lerp(placeholderFontSize, (float)hasValueAnimationPercentage);
737-
_placeholderPaint.Color = _placeholderPaint.Color.WithAlpha((float)hasValueAnimationPercentage);
735+
double placeholderY = controlYCenter.Lerp(focusedPlaceholderCenterY, hasValueAnimationPercentage);
738736

739-
_placeholderPaint.EnsureHasValidFont(placeholder);
737+
_placeholderPaint.TextSize = fontSize.Lerp(placeholderFontSize, (float)hasValueAnimationPercentage);
738+
_placeholderPaint.Color = _placeholderPaint.Color.WithAlpha((float)hasValueAnimationPercentage);
740739

741-
canvas.DrawTextCenteredVertically(placeholder, new SKPoint((float)controlXLeft, (float)placeholderY), _placeholderPaint);
740+
_placeholderPaint.EnsureHasValidFont(placeholder);
741+
742+
canvas.DrawTextCenteredVertically(placeholder, new SKPoint((float)controlXLeft, (float)placeholderY), _placeholderPaint);
743+
}
742744
}
743745

744-
_placeholderPaint.Color = placeholderColor.ToSKColor().WithAlpha(1f - (float)hasValueAnimationPercentage);
746+
_placeholderPaint.Color = (placeholderColor?.ToSKColor() ?? SKColors.Transparent).WithAlpha(1f - (float)hasValueAnimationPercentage);
745747
_placeholderPaint.TextSize = fontSize;
746748

747749
canvas.DrawTextCenteredVertically(placeholder, new SKPoint((float)controlXLeft, (float)controlYCenter), _placeholderPaint);

AuroraControlsMaui/UnderlayDrawableElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static class HavePlaceholderElement
132132
BindableProperty.Create(nameof(IHavePlaceholder.Placeholder), typeof(bool), typeof(IHavePlaceholder), true);
133133

134134
public static readonly BindableProperty PlaceholderColorProperty =
135-
BindableProperty.Create(nameof(IHavePlaceholder.PlaceholderColor), typeof(Microsoft.Maui.Graphics.Color), typeof(IHavePlaceholder), default(Microsoft.Maui.Graphics.Color));
135+
BindableProperty.Create(nameof(IHavePlaceholder.PlaceholderColor), typeof(Microsoft.Maui.Graphics.Color), typeof(IHavePlaceholder), DefaultPlaceholderColor);
136136

137137
public static readonly BindableProperty PlaceholderOffsetProperty =
138138
BindableProperty.Create(nameof(IHavePlaceholder.PlaceholderOffset), typeof(Point), typeof(IHavePlaceholder), default(Point));

0 commit comments

Comments
 (0)