Skip to content

Commit

Permalink
Update CornerRadiusFilterConverter.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Jun 3, 2024
1 parent 0e85f64 commit 9a67285
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions source/iNKORE.UI.WPF/Converters/CornerRadiusFilterConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,33 @@ public static CornerRadius Convert(CornerRadius radius, CornerRadiusFilterKind f

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var cornerRadius = (CornerRadius)value;

var scale = Scale;
if (!double.IsNaN(scale))
if (value is CornerRadius cornerRadius)
{
cornerRadius.TopLeft *= scale;
cornerRadius.TopRight *= scale;
cornerRadius.BottomRight *= scale;
cornerRadius.BottomLeft *= scale;
}
var scale = Scale;
if (!double.IsNaN(scale))
{
cornerRadius.TopLeft *= scale;
cornerRadius.TopRight *= scale;
cornerRadius.BottomRight *= scale;
cornerRadius.BottomLeft *= scale;
}

var filterType = Filter;
if (filterType == CornerRadiusFilterKind.TopLeftValue ||
filterType == CornerRadiusFilterKind.BottomRightValue)
{
return GetDoubleValue(cornerRadius, filterType);
}
var filterType = Filter;
if (filterType == CornerRadiusFilterKind.TopLeftValue ||
filterType == CornerRadiusFilterKind.BottomRightValue)
{
return GetDoubleValue(cornerRadius, filterType);
}

return Convert(cornerRadius, filterType);
return Convert(cornerRadius, filterType);
}
return new CornerRadius(0);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
return new CornerRadius(0);
//throw new NotImplementedException();
}

private double GetDoubleValue(CornerRadius radius, CornerRadiusFilterKind filterKind)
Expand Down

1 comment on commit 9a67285

@LiteCat0905
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️❤️❤️

Please sign in to comment.