mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
chores: improve layout
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<!-- Win2D drawing area -->
|
||||
<uc:LyricsCanvas x:Name="LyricsCanvas" />
|
||||
|
||||
<Grid x:Name="TrackSummaryGridContainer" Loaded="TrackSummaryGridContainer_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="TrackSummaryRowDef" Height="0" />
|
||||
<RowDefinition x:Name="MiddleGapRowDef" Height="0" />
|
||||
@@ -149,7 +149,7 @@
|
||||
<TextBlock
|
||||
x:Name="ArtistsTextBlock"
|
||||
FontWeight="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsFontWeight, Converter={StaticResource LyricsFontWeightToFontWeightConverter}, Mode=OneWay}"
|
||||
Opacity="0.5"
|
||||
Opacity="0.6"
|
||||
TextTrimming="None"
|
||||
Visibility="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.ShowArtists, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</dev:AutoScrollView>
|
||||
@@ -174,7 +174,7 @@
|
||||
<TextBlock
|
||||
x:Name="AlbumTextBlock"
|
||||
FontWeight="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsFontWeight, Converter={StaticResource LyricsFontWeightToFontWeightConverter}, Mode=OneWay}"
|
||||
Opacity="0.5"
|
||||
Opacity="0.3"
|
||||
TextTrimming="None"
|
||||
Visibility="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.ShowAlbum, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</dev:AutoScrollView>
|
||||
@@ -187,8 +187,8 @@
|
||||
<Grid x:Name="LyricsPlaceholder" SizeChanged="LyricsPlaceholder_SizeChanged">
|
||||
<ScrollViewer
|
||||
x:Name="LyricsScrollViewer"
|
||||
PointerExited="LyricsScrollViewer_PointerExited"
|
||||
PointerEntered="LyricsScrollViewer_PointerEntered"
|
||||
PointerExited="LyricsScrollViewer_PointerExited"
|
||||
PointerMoved="LyricsScrollViewer_PointerMoved"
|
||||
PointerPressed="LyricsScrollViewer_PointerPressed"
|
||||
PointerReleased="LyricsScrollViewer_PointerReleased"
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace BetterLyrics.WinUI3.Views
|
||||
Grid.SetRow(SongInfoStackPanel, 3);
|
||||
Grid.SetRowSpan(SongInfoStackPanel, 1);
|
||||
Grid.SetColumn(SongInfoStackPanel, 0);
|
||||
Grid.SetColumnSpan(SongInfoStackPanel, 3);
|
||||
Grid.SetColumnSpan(SongInfoStackPanel, 2);
|
||||
break;
|
||||
case LyricsLayoutOrientation.Vertical:
|
||||
Grid.SetRow(SongInfoStackPanel, 1);
|
||||
@@ -264,7 +264,7 @@ namespace BetterLyrics.WinUI3.Views
|
||||
Grid.SetRow(AlbumArtGrid, 1);
|
||||
Grid.SetRowSpan(AlbumArtGrid, 1);
|
||||
Grid.SetColumn(AlbumArtGrid, 0);
|
||||
Grid.SetColumnSpan(AlbumArtGrid, 3);
|
||||
Grid.SetColumnSpan(AlbumArtGrid, 2);
|
||||
break;
|
||||
case LyricsLayoutOrientation.Vertical:
|
||||
Grid.SetRow(AlbumArtGrid, 1);
|
||||
@@ -343,20 +343,48 @@ namespace BetterLyrics.WinUI3.Views
|
||||
double height = RootGrid.ActualHeight;
|
||||
double width = RootGrid.ActualWidth;
|
||||
|
||||
double middleGapCol = 0;
|
||||
double minSize = Math.Min(width, height);
|
||||
|
||||
double gapBetweenTrackSummaryAndLyrics = 0;
|
||||
double gapBetweenAlbumArtAndSongInfo = 0;
|
||||
double trackSummaryRowHeight = 0;
|
||||
|
||||
double xMargin = 0;
|
||||
double yMargin = 0;
|
||||
|
||||
if (height < 400)
|
||||
switch (status.LyricsLayoutOrientation)
|
||||
{
|
||||
middleGapCol = Math.Max(16, height * 0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
middleGapCol = Math.Max(16, width * 0.15);
|
||||
case LyricsLayoutOrientation.Horizontal:
|
||||
if (width < 800)
|
||||
{
|
||||
xMargin = Math.Clamp(minSize * 0.15, 16, 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
xMargin = Math.Clamp(minSize * 0.25, 16, 128);
|
||||
}
|
||||
yMargin = Math.Max(32, Math.Min(width, height) * 0.15);
|
||||
if (height < 100)
|
||||
{
|
||||
gapBetweenTrackSummaryAndLyrics = Math.Max(16, height * 0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gapBetweenTrackSummaryAndLyrics = 0;
|
||||
}
|
||||
TrackSummaryGridCol0.Width = new(1, GridUnitType.Star);
|
||||
TrackSummaryGridCol2.Width = new(xMargin);
|
||||
break;
|
||||
case LyricsLayoutOrientation.Vertical:
|
||||
xMargin = Math.Max(16, minSize * 0.05);
|
||||
yMargin = Math.Max(16, minSize * 0.05);
|
||||
trackSummaryRowHeight = Math.Max(64, minSize * 0.25);
|
||||
gapBetweenTrackSummaryAndLyrics = Math.Max(16, width * 0.15);
|
||||
TrackSummaryGridCol0.Width = new(1, GridUnitType.Auto);
|
||||
TrackSummaryGridCol2.Width = new(1, GridUnitType.Star);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (height < 100)
|
||||
@@ -368,22 +396,7 @@ namespace BetterLyrics.WinUI3.Views
|
||||
gapBetweenAlbumArtAndSongInfo = lyricsLayoutMetrics.SongTitleSize / 2;
|
||||
}
|
||||
|
||||
switch (status.LyricsLayoutOrientation)
|
||||
{
|
||||
case LyricsLayoutOrientation.Horizontal:
|
||||
xMargin = Math.Clamp(Math.Min(width, height) * 0.25, 16, 128);
|
||||
yMargin = Math.Max(32, Math.Min(width, height) * 0.15);
|
||||
break;
|
||||
case LyricsLayoutOrientation.Vertical:
|
||||
xMargin = Math.Max(16, Math.Min(width, height) * 0.05);
|
||||
yMargin = Math.Max(16, Math.Min(width, height) * 0.05);
|
||||
trackSummaryRowHeight = Math.Max(64, height * 0.25);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
MiddleGapColDef.Width = new(middleGapCol);
|
||||
MiddleGapColDef.Width = new(gapBetweenTrackSummaryAndLyrics);
|
||||
|
||||
TrackSummaryGridRow0.Height = new(yMargin);
|
||||
TrackSummaryGridRow4.Height = new(yMargin);
|
||||
@@ -644,11 +657,6 @@ namespace BetterLyrics.WinUI3.Views
|
||||
OnLayoutChanged();
|
||||
}
|
||||
|
||||
private void TrackSummaryGridContainer_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnLayoutChanged();
|
||||
}
|
||||
|
||||
private void ShadowCastGrid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
UpdateAlbumArtCornerRadius();
|
||||
|
||||
Reference in New Issue
Block a user