mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature: auto scrolling while seleting text in commit message (#394)
This commit is contained in:
parent
551ea883ff
commit
959805d63c
2 changed files with 23 additions and 5 deletions
|
@ -114,7 +114,23 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
base.OnPointerMoved(e);
|
base.OnPointerMoved(e);
|
||||||
|
|
||||||
if (e.Pointer.Captured == null && _matches != null)
|
if (e.Pointer.Captured == this)
|
||||||
|
{
|
||||||
|
var relativeSelfY = e.GetPosition(this).Y;
|
||||||
|
if (relativeSelfY <= 0 || relativeSelfY > Bounds.Height)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var scrollViewer = this.FindAncestorOfType<ScrollViewer>();
|
||||||
|
if (scrollViewer != null)
|
||||||
|
{
|
||||||
|
var relativeY = e.GetPosition(scrollViewer).Y;
|
||||||
|
if (relativeY <= 8)
|
||||||
|
scrollViewer.LineUp();
|
||||||
|
else if (relativeY >= scrollViewer.Bounds.Height - 8)
|
||||||
|
scrollViewer.LineDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_matches != null)
|
||||||
{
|
{
|
||||||
var point = e.GetPosition(this) - new Point(Padding.Left, Padding.Top);
|
var point = e.GetPosition(this) - new Point(Padding.Left, Padding.Top);
|
||||||
var x = Math.Min(Math.Max(point.X, 0), Math.Max(TextLayout.WidthIncludingTrailingWhitespace, 0));
|
var x = Math.Min(Math.Max(point.X, 0), Math.Max(TextLayout.WidthIncludingTrailingWhitespace, 0));
|
||||||
|
|
|
@ -48,10 +48,12 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="m:RevisionSubmodule">
|
<DataTemplate DataType="m:RevisionSubmodule">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Margin="8,8,8,0">
|
<Grid RowDefinitions="Auto,*" Margin="8,0">
|
||||||
<TextBlock Text="{DynamicResource Text.CommitDetail.Files.Submodule}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
<TextBlock Grid.Row="0" Margin="0,8,0,0" Text="{DynamicResource Text.CommitDetail.Files.Submodule}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
<v:CommitBaseInfo Margin="0,16,0,0" Content="{Binding Commit}" Message="{Binding FullMessage}"/>
|
<ScrollViewer Grid.Row="1" Margin="0,16,0,0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||||
</StackPanel>
|
<v:CommitBaseInfo Content="{Binding Commit}" Message="{Binding FullMessage}"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</UserControl.DataTemplates>
|
</UserControl.DataTemplates>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
Loading…
Reference in a new issue