diff --git a/src/Ursa.Themes.Semi/Controls/Dialog.axaml b/src/Ursa.Themes.Semi/Controls/Dialog.axaml index 66a500a..33ae22e 100644 --- a/src/Ursa.Themes.Semi/Controls/Dialog.axaml +++ b/src/Ursa.Themes.Semi/Controls/Dialog.axaml @@ -8,7 +8,7 @@ - + @@ -141,7 +141,7 @@ - + diff --git a/src/Ursa.Themes.Semi/Controls/Drawer.axaml b/src/Ursa.Themes.Semi/Controls/Drawer.axaml index dff0cd2..b013000 100644 --- a/src/Ursa.Themes.Semi/Controls/Drawer.axaml +++ b/src/Ursa.Themes.Semi/Controls/Drawer.axaml @@ -1,20 +1,24 @@ + xmlns:u="https://irihi.tech/ursa" + xmlns:c="clr-namespace:Ursa.Themes.Semi.Converters"> + + + @@ -43,41 +47,44 @@ + + + @@ -143,24 +150,24 @@ diff --git a/src/Ursa.Themes.Semi/Converters/CornerRadiusTakeConverter.cs b/src/Ursa.Themes.Semi/Converters/CornerRadiusTakeConverter.cs new file mode 100644 index 0000000..57ea3c5 --- /dev/null +++ b/src/Ursa.Themes.Semi/Converters/CornerRadiusTakeConverter.cs @@ -0,0 +1,37 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Data.Converters; + +namespace Ursa.Themes.Semi.Converters; + +public class CornerRadiusTakeConverter: IValueConverter +{ + private readonly Dock _dock; + internal CornerRadiusTakeConverter(Dock dock) + { + _dock = dock; + } + public static CornerRadiusTakeConverter Left { get; } = new(Dock.Left); + public static CornerRadiusTakeConverter Top { get; } = new(Dock.Top); + public static CornerRadiusTakeConverter Right { get; } = new(Dock.Right); + public static CornerRadiusTakeConverter Bottom { get; } = new(Dock.Bottom); + + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if(value is not CornerRadius c) return AvaloniaProperty.UnsetValue; + return _dock switch + { + Dock.Left => new CornerRadius(c.TopLeft, 0, 0, c.BottomLeft), + Dock.Top => new CornerRadius(c.TopLeft, c.TopRight, 0, 0), + Dock.Right => new CornerRadius(0, c.TopRight, c.BottomRight, 0), + Dock.Bottom => new CornerRadius(0, 0, c.BottomRight, c.BottomLeft), + _ => AvaloniaProperty.UnsetValue + }; + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/src/Ursa.Themes.Semi/Converters/ThicknessTakeConverter.cs b/src/Ursa.Themes.Semi/Converters/ThicknessTakeConverter.cs new file mode 100644 index 0000000..0ddab64 --- /dev/null +++ b/src/Ursa.Themes.Semi/Converters/ThicknessTakeConverter.cs @@ -0,0 +1,36 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Data.Converters; + +namespace Ursa.Themes.Semi.Converters; + +public class ThicknessTakeConverter: IValueConverter +{ + private readonly Dock _dock; + internal ThicknessTakeConverter(Dock dock) + { + _dock = dock; + } + public static ThicknessTakeConverter Left { get; } = new(Dock.Left); + public static ThicknessTakeConverter Top { get; } = new(Dock.Top); + public static ThicknessTakeConverter Right { get; } = new(Dock.Right); + public static ThicknessTakeConverter Bottom { get; } = new(Dock.Bottom); + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is not Thickness t) return AvaloniaProperty.UnsetValue; + return _dock switch + { + Dock.Left => new Thickness(t.Left, 0, 0, 0), + Dock.Top => new Thickness(0, t.Top, 0, 0), + Dock.Right => new Thickness(0, 0, t.Right, 0), + Dock.Bottom => new Thickness(0, 0, 0, t.Bottom), + _ => AvaloniaProperty.UnsetValue + }; + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/src/Ursa.Themes.Semi/Themes/Shared/Dialog.axaml b/src/Ursa.Themes.Semi/Themes/Shared/Dialog.axaml index d067400..f3c6409 100644 --- a/src/Ursa.Themes.Semi/Themes/Shared/Dialog.axaml +++ b/src/Ursa.Themes.Semi/Themes/Shared/Dialog.axaml @@ -5,4 +5,5 @@ M2,2H11V6H9V4H4V9H6V11H2V2M22,13V22H13V18H15V20H20V15H18V13H22M8,8H16V16H8V8Z M2,2H16V16H2V2M22,8V22H8V18H18V8H22M4,4V14H14V4H4Z M2,2H11V11H2V2M9,4H4V9H9V4M22,13V22H13V13H22M15,20H20V15H15V20M16,8V11H13V8H16M11,16H8V13H11V16Z + 12 diff --git a/src/Ursa.Themes.Semi/Themes/Shared/Drawer.axaml b/src/Ursa.Themes.Semi/Themes/Shared/Drawer.axaml new file mode 100644 index 0000000..3a66393 --- /dev/null +++ b/src/Ursa.Themes.Semi/Themes/Shared/Drawer.axaml @@ -0,0 +1,7 @@ + + + 12 + 8 + 1 + diff --git a/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml b/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml index a09a2aa..835e77a 100644 --- a/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml +++ b/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml @@ -8,6 +8,7 @@ +