feat: change hand length.

This commit is contained in:
rabbitism
2024-04-23 22:02:17 +08:00
parent db6ba785dd
commit 823bb2ee8c
2 changed files with 34 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace Ursa.Themes.Semi.Converters;
public class ClockHandLengthConverter(double ratio) : IValueConverter
{
public static ClockHandLengthConverter Hour { get; } = new(1-0.618);
public static ClockHandLengthConverter Minute { get; } = new(0.618);
public static ClockHandLengthConverter Second { get; } = new(1);
private double _ratio = ratio;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is double d)
{
return d * ratio / 2;
}
return 0.0;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}