This commit is contained in:
Zhe Fang
2025-07-17 14:45:00 -04:00
parent 042d557eb1
commit 8f997ca3d9
3 changed files with 23 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages; using CommunityToolkit.Mvvm.Messaging.Messages;
using Microsoft.UI.Xaml; using Microsoft.UI.Xaml;
using System.Numerics;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.ViewModels namespace BetterLyrics.WinUI3.ViewModels
@@ -62,6 +63,9 @@ namespace BetterLyrics.WinUI3.ViewModels
//[ObservableProperty] //[ObservableProperty]
//public partial int Volume { get; set; } //public partial int Volume { get; set; }
[ObservableProperty]
public partial Vector3 BottomCenterCommandGridTranslation { get; set; } = new Vector3(0, 0, 0);
[ObservableProperty] [ObservableProperty]
public partial bool IsImmersiveMode { get; set; } public partial bool IsImmersiveMode { get; set; }

View File

@@ -18,7 +18,7 @@
xmlns:ui="using:CommunityToolkit.WinUI" xmlns:ui="using:CommunityToolkit.WinUI"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid x:Name="RootGrid"> <Grid x:Name="RootGrid" SizeChanged="RootGrid_SizeChanged">
<!-- Lyrics area --> <!-- Lyrics area -->
<renderer:LyricsRenderer /> <renderer:LyricsRenderer />
@@ -140,14 +140,15 @@
<Grid <Grid
Padding="3" Padding="3"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Style="{StaticResource CardGridStyle}"> Style="{StaticResource CardGridStyle}"
Translation="{x:Bind ViewModel.BottomCenterCommandGridTranslation, Mode=OneWay}">
<Grid.TranslationTransition>
<Vector3Transition />
</Grid.TranslationTransition>
<StackPanel <StackPanel
x:Name="BottomCenterCommandStackPanel" x:Name="BottomCenterCommandStackPanel"
Orientation="Horizontal" Orientation="Horizontal"
Spacing="3"> Spacing="3">
<StackPanel.OpacityTransition>
<ScalarTransition />
</StackPanel.OpacityTransition>
<Button <Button
Command="{x:Bind ViewModel.PreviousSongCommand}" Command="{x:Bind ViewModel.PreviousSongCommand}"
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},

View File

@@ -14,7 +14,7 @@ namespace BetterLyrics.WinUI3.Views
public sealed partial class LyricsPage : Page public sealed partial class LyricsPage : Page
{ {
private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService<ISettingsService>(); private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
public LyricsPage() public LyricsPage()
{ {
this.InitializeComponent(); this.InitializeComponent();
@@ -82,5 +82,17 @@ namespace BetterLyrics.WinUI3.Views
{ {
TranslationFlyout.ShowAt(BottomRightCommandStackPanel); TranslationFlyout.ShowAt(BottomRightCommandStackPanel);
} }
private void RootGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.NewSize.Width < 500)
{
ViewModel.BottomCenterCommandGridTranslation = new System.Numerics.Vector3(0, -48, 0);
}
else
{
ViewModel.BottomCenterCommandGridTranslation = new System.Numerics.Vector3(0, 0, 0);
}
}
} }
} }