mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-04 21:16:58 +01:00
Let the consist panel shrink with the small thumbnails
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="StarterNG.Views.Scenarios"
|
x:Class="StarterNG.Views.Scenarios"
|
||||||
x:CompileBindings="True">
|
x:CompileBindings="True">
|
||||||
<Grid Margin="0" ColumnSpacing="0" RowSpacing="3">
|
<Grid Name="scenariosGrid" Margin="0" ColumnSpacing="0" RowSpacing="3">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" MinWidth="200" MaxWidth="460" />
|
<ColumnDefinition Width="*" MinWidth="200" MaxWidth="460" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@@ -15,8 +15,9 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<!-- Measures itself, so a whole card fits at either thumbnail size. -->
|
<!-- Measures itself, so a whole card fits at either thumbnail size; the
|
||||||
<RowDefinition Height="Auto" MinHeight="120" MaxHeight="200" />
|
floor follows the thumbnail size, see SyncConsistRowHeight. -->
|
||||||
|
<RowDefinition Height="Auto" MaxHeight="200" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<HeaderedContentControl Grid.Column="0" Grid.Row="0" Theme="{StaticResource GroupBox}"
|
<HeaderedContentControl Grid.Column="0" Grid.Row="0" Theme="{StaticResource GroupBox}"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public partial class Scenarios : UserControl
|
|||||||
public Scenarios()
|
public Scenarios()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SyncConsistRowHeight();
|
||||||
|
|
||||||
Sceneries = AppServices.Current.Library.Sceneries;
|
Sceneries = AppServices.Current.Library.Sceneries;
|
||||||
|
|
||||||
@@ -418,8 +419,22 @@ public partial class Scenarios : UserControl
|
|||||||
RandomizeTexturesRequested?.Invoke(scenery);
|
RandomizeTexturesRequested?.Invoke(scenery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The floor of the consist row, so the small thumbnails do not sit in the
|
||||||
|
/// height the large ones need.
|
||||||
|
/// </summary>
|
||||||
|
private const double SmallConsistRowHeight = 84;
|
||||||
|
|
||||||
|
private const double LargeConsistRowHeight = 120;
|
||||||
|
|
||||||
|
private void SyncConsistRowHeight() =>
|
||||||
|
scenariosGrid.RowDefinitions[1].MinHeight = AppServices.Current.Settings.LargeThumbnails
|
||||||
|
? LargeConsistRowHeight
|
||||||
|
: SmallConsistRowHeight;
|
||||||
|
|
||||||
public void RefreshConsistView()
|
public void RefreshConsistView()
|
||||||
{
|
{
|
||||||
|
SyncConsistRowHeight();
|
||||||
RefreshVehicleLabels();
|
RefreshVehicleLabels();
|
||||||
if (AppServices.Current.State.CurrentTrainset is { } trainset)
|
if (AppServices.Current.State.CurrentTrainset is { } trainset)
|
||||||
ShowConsist(trainset);
|
ShowConsist(trainset);
|
||||||
|
|||||||
Reference in New Issue
Block a user