feat: update selection handling, fix initial offset calculation.

This commit is contained in:
Dong Bin
2025-07-08 13:36:11 +08:00
parent 68f95826c5
commit fb799636d9
8 changed files with 116 additions and 57 deletions

View File

@@ -1,23 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
namespace Ursa.Themes.Semi.Converters;
public class NavigationMenuItemLevelToMarginConverter: IMultiValueConverter
{
public int Indent { get; set; }
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is int i && values[1] is bool b)
{
if (b)
{
return new Thickness();
}
return new Thickness((i-1) * Indent, 0, 0, 0);
}
return new Thickness();
}
}

View File

@@ -0,0 +1,17 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
namespace Ursa.Themes.Semi.Converters;
public class TreeLevelToMarginConverter: IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is int i && values[1] is double indent)
{
return new Thickness((i-1) * indent, 0, 0, 0);
}
return new Thickness();
}
}