Skip to content

Commit

Permalink
Merge pull request #752 from unoplatform/dev/xygu/20230823/shadow-rework
Browse files Browse the repository at this point in the history
Dev/xygu/20230823/shadow-rework
  • Loading branch information
jeromelaban authored Aug 29, 2023
2 parents f760d54 + b57d6e6 commit ce2a55f
Show file tree
Hide file tree
Showing 12 changed files with 742 additions and 780 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
Padding="10"
Height="220"
Width="220">
<utu:ShadowContainer x:Name="shadowContainer">
<utu:ShadowContainer x:Name="shadowContainer"
Background="Green">
<Border Width="200"
Height="200"
x:Name="border"
Background="Green" />
x:Name="border" />
</utu:ShadowContainer>
</Border>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HexToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return value.ToString();
return value?.ToString();
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
13 changes: 0 additions & 13 deletions src/Uno.Toolkit.Skia.WinUI/Controls/Shadows/Shadow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,6 @@ public double Spread

public event PropertyChangedEventHandler? PropertyChanged;

internal static bool IsShadowProperty(string propertyName)
{
return propertyName == nameof(OffsetX) || propertyName == nameof(OffsetY) ||
propertyName == nameof(IsInner) ||
propertyName == nameof(Color) ||
propertyName == nameof(Opacity) ||
propertyName == nameof(BlurRadius) ||
propertyName == nameof(Spread);
}

internal static bool IsShadowSizeProperty(string propertyName)
{
return propertyName == nameof(OffsetX) || propertyName == nameof(OffsetY) ||
Expand All @@ -174,9 +164,6 @@ private static void OnPropertyChanged(object dependencyObject, string propertyNa
public override string ToString() =>
$"{{ IsInner: {{{IsInner}}}, Offset: {{{OffsetX}, {OffsetY}}} Color: {{A={Color.A}, R={Color.R}, G={Color.G}, B={Color.B}}}, Opacity: {Opacity}, BlurRadius: {BlurRadius}, Spread: {Spread} }}";

public string ToKey() =>
string.Join(",", IsInner, OffsetX, OffsetY, Color.ToString(), Opacity, BlurRadius, Spread);

public Shadow Clone()
{
return new Shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@ namespace Uno.Toolkit.UI;

public class ShadowCollection : ObservableCollection<Shadow>
{
public bool HasInnerShadow() => this.Any(s => s.IsInner);

public string ToKey(double width, double height, Windows.UI.Color? contentBackground)
=> string.Create(CultureInfo.InvariantCulture, $"w{width},h{height}") +
(contentBackground.HasValue ? $",cb{contentBackground.Value}:" : ":") +
string.Join("/", this.Select(x => x.ToKey()));
}
Loading

0 comments on commit ce2a55f

Please sign in to comment.