mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-21 16:14:28 +08:00
changed.调整融合桌面组库的相关圆角
This commit is contained in:
@@ -107,4 +107,18 @@ public sealed class ComponentCategoryIconResolverTests
|
|||||||
var result = ComponentCategoryIconResolver.ResolveCategoryIcon("File", components);
|
var result = ComponentCategoryIconResolver.ResolveCategoryIcon("File", components);
|
||||||
Assert.Equal(Icon.Folder, result);
|
Assert.Equal(Icon.Folder, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ResolveCategoryIcon_Date_ResolvesCorrectly()
|
||||||
|
{
|
||||||
|
var result = ComponentCategoryIconResolver.ResolveCategoryIcon("Date", []);
|
||||||
|
Assert.Equal(Icon.Calendar, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ResolveCategoryIcon_Study_ResolvesCorrectly()
|
||||||
|
{
|
||||||
|
var result = ComponentCategoryIconResolver.ResolveCategoryIcon("Study", []);
|
||||||
|
Assert.Equal(Icon.Book, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,15 +14,34 @@ public static class ComponentCategoryIconResolver
|
|||||||
return Icon.Apps;
|
return Icon.Apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var icon = categoryId.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"clock" => Icon.Clock,
|
||||||
|
"date" => Icon.Calendar,
|
||||||
|
"weather" => Icon.WeatherSunny,
|
||||||
|
"board" => Icon.Edit,
|
||||||
|
"media" => Icon.Play,
|
||||||
|
"info" => Icon.News,
|
||||||
|
"calculator" => Icon.Calculator,
|
||||||
|
"study" => Icon.Book,
|
||||||
|
"file" => Icon.Folder,
|
||||||
|
_ => (Icon?)null
|
||||||
|
};
|
||||||
|
|
||||||
|
if (icon.HasValue)
|
||||||
|
{
|
||||||
|
return icon.Value;
|
||||||
|
}
|
||||||
|
|
||||||
var firstComponent = categoryComponents.FirstOrDefault();
|
var firstComponent = categoryComponents.FirstOrDefault();
|
||||||
if (firstComponent is null || string.IsNullOrWhiteSpace(firstComponent.IconKey))
|
if (firstComponent is null || string.IsNullOrWhiteSpace(firstComponent.IconKey))
|
||||||
{
|
{
|
||||||
return Icon.Apps;
|
return Icon.Apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enum.TryParse<Icon>(firstComponent.IconKey, ignoreCase: true, out var icon))
|
if (Enum.TryParse<Icon>(firstComponent.IconKey, ignoreCase: true, out var resolvedIcon))
|
||||||
{
|
{
|
||||||
return icon;
|
return resolvedIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Icon.Apps;
|
return Icon.Apps;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
Background="{DynamicResource AdaptiveNavItemBackgroundBrush}">
|
Background="{DynamicResource AdaptiveNavItemBackgroundBrush}">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="8">
|
ColumnSpacing="8">
|
||||||
<fi:SymbolIcon Symbol="{Binding Icon}"
|
<fi:FluentIcon Icon="{Binding Icon}"
|
||||||
IconVariant="Regular"
|
IconVariant="Regular"
|
||||||
FontSize="16" />
|
FontSize="16" />
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
|
CornerRadius="{DynamicResource DesignCornerRadiusLg}"
|
||||||
ClipToBounds="True">
|
ClipToBounds="True">
|
||||||
<Grid RowDefinitions="Auto,*,Auto">
|
<Grid RowDefinitions="Auto,*,Auto">
|
||||||
<Border Height="64"
|
<Border Height="64"
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
using LanMountainDesktop.Appearance;
|
||||||
using LanMountainDesktop.Services;
|
using LanMountainDesktop.Services;
|
||||||
|
using LanMountainDesktop.Settings.Core;
|
||||||
|
|
||||||
namespace LanMountainDesktop.Views;
|
namespace LanMountainDesktop.Views;
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ public partial class FusedDesktopComponentLibraryWindow : Window
|
|||||||
public FusedDesktopComponentLibraryWindow()
|
public FusedDesktopComponentLibraryWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ApplyFluentCornerRadius();
|
||||||
|
|
||||||
LibraryControl.AddComponentRequested += OnAddComponentRequested;
|
LibraryControl.AddComponentRequested += OnAddComponentRequested;
|
||||||
KeyDown += OnWindowKeyDown;
|
KeyDown += OnWindowKeyDown;
|
||||||
@@ -23,6 +26,25 @@ public partial class FusedDesktopComponentLibraryWindow : Window
|
|||||||
mainWindow?.RegisterFusedLibraryWindow(this);
|
mainWindow?.RegisterFusedLibraryWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ApplyFluentCornerRadius()
|
||||||
|
{
|
||||||
|
if (RootGrid is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tokens = AppearanceCornerRadiusTokenFactory.Create(
|
||||||
|
GlobalAppearanceSettings.CornerRadiusStyleFluent);
|
||||||
|
RootGrid.Resources["DesignCornerRadiusMicro"] = tokens.Micro;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusXs"] = tokens.Xs;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusSm"] = tokens.Sm;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusMd"] = tokens.Md;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusLg"] = tokens.Lg;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusXl"] = tokens.Xl;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusIsland"] = tokens.Island;
|
||||||
|
RootGrid.Resources["DesignCornerRadiusComponent"] = tokens.Component;
|
||||||
|
}
|
||||||
|
|
||||||
public bool PreserveEditModeOnClose { get; private set; }
|
public bool PreserveEditModeOnClose { get; private set; }
|
||||||
|
|
||||||
public void SetOverlayWindow(TransparentOverlayWindow overlayWindow)
|
public void SetOverlayWindow(TransparentOverlayWindow overlayWindow)
|
||||||
|
|||||||
Reference in New Issue
Block a user