mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-23 01:44:26 +08:00
fix.快捷方式组件的透明问题修复。顺便修了一下电源菜单。
This commit is contained in:
@@ -71,12 +71,21 @@ public partial class ShortcutWidget : UserControl, IDesktopComponentWidget, ICom
|
|||||||
public void ApplyCellSize(double cellSize)
|
public void ApplyCellSize(double cellSize)
|
||||||
{
|
{
|
||||||
_currentCellSize = cellSize;
|
_currentCellSize = cellSize;
|
||||||
var iconSize = Math.Clamp(cellSize * 0.5, 24, 64);
|
|
||||||
|
// 图标大小:从 cellSize 的 50% 计算,最小 24px,最大 128px
|
||||||
|
var iconSize = Math.Clamp(cellSize * 0.5, 24, 128);
|
||||||
IconImage.Width = iconSize;
|
IconImage.Width = iconSize;
|
||||||
IconImage.Height = iconSize;
|
IconImage.Height = iconSize;
|
||||||
|
|
||||||
var fontSize = Math.Clamp(cellSize * 0.18, 10, 16);
|
// 字体大小:从 cellSize 的 18% 计算,最小 10px,最大 24px
|
||||||
|
var fontSize = Math.Clamp(cellSize * 0.18, 10, 24);
|
||||||
NameTextBlock.FontSize = fontSize;
|
NameTextBlock.FontSize = fontSize;
|
||||||
|
|
||||||
|
// 更新符号图标的大小(如果当前显示的是符号图标)
|
||||||
|
if (SymbolIconHost.Content is SymbolIcon symbolIcon)
|
||||||
|
{
|
||||||
|
symbolIcon.FontSize = iconSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateDisplay()
|
private void UpdateDisplay()
|
||||||
@@ -113,10 +122,13 @@ public partial class ShortcutWidget : UserControl, IDesktopComponentWidget, ICom
|
|||||||
IconImage.IsVisible = false;
|
IconImage.IsVisible = false;
|
||||||
IconImage.Source = null;
|
IconImage.Source = null;
|
||||||
|
|
||||||
|
// 计算图标大小
|
||||||
|
var iconSize = Math.Clamp(_currentCellSize * 0.5, 24, 128);
|
||||||
|
|
||||||
var iconHostContent = new SymbolIcon
|
var iconHostContent = new SymbolIcon
|
||||||
{
|
{
|
||||||
Symbol = FluentIcons.Common.Symbol.Add,
|
Symbol = FluentIcons.Common.Symbol.Add,
|
||||||
FontSize = 32,
|
FontSize = iconSize,
|
||||||
Foreground = iconBrush,
|
Foreground = iconBrush,
|
||||||
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
|
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
|
||||||
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
|
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
|
||||||
@@ -224,10 +236,13 @@ public partial class ShortcutWidget : UserControl, IDesktopComponentWidget, ICom
|
|||||||
IconImage.IsVisible = false;
|
IconImage.IsVisible = false;
|
||||||
IconImage.Source = null;
|
IconImage.Source = null;
|
||||||
|
|
||||||
|
// 计算图标大小
|
||||||
|
var iconSize = Math.Clamp(_currentCellSize * 0.5, 24, 128);
|
||||||
|
|
||||||
var iconHostContent = new SymbolIcon
|
var iconHostContent = new SymbolIcon
|
||||||
{
|
{
|
||||||
Symbol = symbol,
|
Symbol = symbol,
|
||||||
FontSize = 32,
|
FontSize = iconSize,
|
||||||
Foreground = iconBrush,
|
Foreground = iconBrush,
|
||||||
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
|
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
|
||||||
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
|
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
|
||||||
|
|||||||
@@ -508,38 +508,34 @@
|
|||||||
</Grid.RenderTransform>
|
</Grid.RenderTransform>
|
||||||
<StackPanel Spacing="8">
|
<StackPanel Spacing="8">
|
||||||
<Button x:Name="TaskbarPowerBackButton"
|
<Button x:Name="TaskbarPowerBackButton"
|
||||||
Padding="4,6"
|
Classes="taskbar-profile-popup-action"
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0"
|
|
||||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Click="OnPowerMenuBackClick">
|
Click="OnPowerMenuBackClick">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
<fi:SymbolIcon Classes="icon-s"
|
ColumnSpacing="12">
|
||||||
Symbol="ArrowLeft"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
IconVariant="Regular" />
|
Kind="ArrowLeft" />
|
||||||
<TextBlock x:Name="TaskbarPowerBackTextBlock"
|
<TextBlock x:Name="TaskbarPowerBackTextBlock"
|
||||||
VerticalAlignment="Center"
|
Grid.Column="1"
|
||||||
|
Classes="taskbar-profile-popup-action-text"
|
||||||
Text="Back" />
|
Text="Back" />
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<TextBlock x:Name="TaskbarPowerTitleTextBlock"
|
<TextBlock x:Name="TaskbarPowerTitleTextBlock"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
Foreground="{DynamicResource TaskbarProfilePopupTextBrush}"
|
Foreground="{DynamicResource TaskbarProfilePopupTextBrush}"
|
||||||
Margin="2,6,0,0"
|
|
||||||
Text="Power" />
|
Text="Power" />
|
||||||
|
|
||||||
<Border Height="1"
|
<Border Height="1"
|
||||||
Background="{DynamicResource TaskbarProfilePopupDividerBrush}"
|
Background="{DynamicResource TaskbarProfilePopupDividerBrush}" />
|
||||||
Margin="0,4" />
|
|
||||||
|
|
||||||
<Button x:Name="PowerShutdownButton"
|
<Button x:Name="PowerShutdownButton"
|
||||||
Classes="taskbar-profile-popup-action"
|
Classes="taskbar-profile-popup-action"
|
||||||
Click="OnPowerShutdownClick">
|
Click="OnPowerShutdownClick">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="14">
|
ColumnSpacing="12">
|
||||||
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
Kind="Power" />
|
Kind="Power" />
|
||||||
<TextBlock x:Name="PowerShutdownTextBlock"
|
<TextBlock x:Name="PowerShutdownTextBlock"
|
||||||
@@ -553,7 +549,7 @@
|
|||||||
Classes="taskbar-profile-popup-action"
|
Classes="taskbar-profile-popup-action"
|
||||||
Click="OnPowerRestartClick">
|
Click="OnPowerRestartClick">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="14">
|
ColumnSpacing="12">
|
||||||
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
Kind="Refresh" />
|
Kind="Refresh" />
|
||||||
<TextBlock x:Name="PowerRestartTextBlock"
|
<TextBlock x:Name="PowerRestartTextBlock"
|
||||||
@@ -567,7 +563,7 @@
|
|||||||
Classes="taskbar-profile-popup-action"
|
Classes="taskbar-profile-popup-action"
|
||||||
Click="OnPowerLogoutClick">
|
Click="OnPowerLogoutClick">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="14">
|
ColumnSpacing="12">
|
||||||
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
Kind="ExitToApp" />
|
Kind="ExitToApp" />
|
||||||
<TextBlock x:Name="PowerLogoutTextBlock"
|
<TextBlock x:Name="PowerLogoutTextBlock"
|
||||||
@@ -581,7 +577,7 @@
|
|||||||
Classes="taskbar-profile-popup-action"
|
Classes="taskbar-profile-popup-action"
|
||||||
Click="OnPowerSleepClick">
|
Click="OnPowerSleepClick">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="14">
|
ColumnSpacing="12">
|
||||||
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
Kind="WeatherNight" />
|
Kind="WeatherNight" />
|
||||||
<TextBlock x:Name="PowerSleepTextBlock"
|
<TextBlock x:Name="PowerSleepTextBlock"
|
||||||
@@ -595,7 +591,7 @@
|
|||||||
Classes="taskbar-profile-popup-action"
|
Classes="taskbar-profile-popup-action"
|
||||||
Click="OnPowerLockClick">
|
Click="OnPowerLockClick">
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="14">
|
ColumnSpacing="12">
|
||||||
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
|
||||||
Kind="Lock" />
|
Kind="Lock" />
|
||||||
<TextBlock x:Name="PowerLockTextBlock"
|
<TextBlock x:Name="PowerLockTextBlock"
|
||||||
|
|||||||
Reference in New Issue
Block a user