feature: show image size change for Models.ImageDiff

This commit is contained in:
leo 2024-03-28 09:48:42 +08:00
parent 223467480f
commit 582a283ad5
2 changed files with 20 additions and 3 deletions

View file

@ -553,6 +553,9 @@ namespace SourceGit.Models
{
public Bitmap Old { get; set; } = null;
public Bitmap New { get; set; } = null;
public string OldSize => Old != null ? $"{Old.PixelSize.Width} x {Old.PixelSize.Height}" : "0 x 0";
public string NewSize => New != null ? $"{New.PixelSize.Width} x {New.PixelSize.Height}" : "0 x 0";
}
public class NoOrEOLChange

View file

@ -111,14 +111,28 @@
<!-- Image Diff -->
<DataTemplate DataType="m:ImageDiff">
<Grid Margin="8,8,8,8" RowDefinitions="*,Auto" HorizontalAlignment="Center">
<Border Grid.Row="0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
<Grid Margin="8,8,8,8" RowDefinitions="Auto,*,Auto" HorizontalAlignment="Center">
<Grid Grid.Row="0" Margin="0,0,0,8" ColumnDefinitions="Auto,Auto,*,Auto,Auto">
<Border Grid.Column="0" Height="16" Background="{DynamicResource Brush.Badge}" CornerRadius="8" VerticalAlignment="Center">
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.Old}" Margin="8,0" FontSize="10"/>
</Border>
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding OldSize}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
<Border Grid.Column="3" Height="16" Background="Green" CornerRadius="8" VerticalAlignment="Center" Margin="32,0,0,0">
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.New}" Margin="8,0" FontSize="10"/>
</Border>
<TextBlock Grid.Column="4" Classes="monospace" Text="{Binding NewSize}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<Border Grid.Row="1" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
<v:ImageDiffView Alpha="{Binding #ImageDiffSlider.Value}"
OldImage="{Binding Old}"
NewImage="{Binding New}"/>
</Border>
<Slider Grid.Row="1"
<Slider Grid.Row="2"
x:Name="ImageDiffSlider"
Minimum="0" Maximum="1"
VerticalAlignment="Top"