mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 05:05:00 +00:00
fix: Ensure each ImageView instance calculates its own aspect ratio (#929)
* fix: Ensure each ImageView instance calculates its own aspect ratio - Modified ArrangeOverride methods in ImageView class to independently calculate and apply the aspect ratio based on the instance's image. Signed-off-by: Gadfly <gadfly@gadfly.vip> * fix: Make IgnoredWhitespace toggle button visible based on IsTextDiff --------- Signed-off-by: Gadfly <gadfly@gadfly.vip>
This commit is contained in:
parent
dd254ebf4f
commit
92065dee12
2 changed files with 15 additions and 0 deletions
|
@ -129,6 +129,7 @@
|
||||||
<ToggleButton Classes="line_path"
|
<ToggleButton Classes="line_path"
|
||||||
Width="28"
|
Width="28"
|
||||||
IsChecked="{Binding IgnoreWhitespace, Mode=TwoWay}"
|
IsChecked="{Binding IgnoreWhitespace, Mode=TwoWay}"
|
||||||
|
IsVisible="{Binding IsTextDiff}"
|
||||||
ToolTip.Tip="{DynamicResource Text.Diff.IgnoreWhitespace}">
|
ToolTip.Tip="{DynamicResource Text.Diff.IgnoreWhitespace}">
|
||||||
<Path Width="14" Height="14" Stretch="Uniform" Data="{StaticResource Icons.Whitespace}"/>
|
<Path Width="14" Height="14" Stretch="Uniform" Data="{StaticResource Icons.Whitespace}"/>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
|
|
|
@ -92,6 +92,20 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
return availableSize;
|
return availableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
if (Image is { } image)
|
||||||
|
{
|
||||||
|
var imageSize = image.Size;
|
||||||
|
var scaleW = finalSize.Width / imageSize.Width;
|
||||||
|
var scaleH = finalSize.Height / imageSize.Height;
|
||||||
|
var scale = Math.Min(scaleW, scaleH);
|
||||||
|
return new Size(scale * imageSize.Width, scale * imageSize.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.ArrangeOverride(finalSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImageSwipeControl : ImageContainer
|
public class ImageSwipeControl : ImageContainer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue