mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
enhance: move Create New Page
button out of tab list if scroll arrow is visible (#958)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
2495911bd8
commit
aa0d066944
2 changed files with 27 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.LauncherTabBar"
|
||||
x:DataType="vm:Launcher">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
||||
<RepeatButton x:Name="LeftScrollIndicator" Grid.Column="0" Classes="icon_button" Width="18" Height="30" Click="ScrollTabsLeft">
|
||||
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||
</RepeatButton>
|
||||
|
@ -96,7 +96,8 @@
|
|||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Button Classes="icon_button"
|
||||
<Button x:Name="InnerNewTabBtn"
|
||||
Classes="icon_button"
|
||||
Width="16" Height="16"
|
||||
Margin="8,0"
|
||||
Command="{Binding AddNewTab}">
|
||||
|
@ -115,5 +116,21 @@
|
|||
<RepeatButton x:Name="RightScrollIndicator" Grid.Column="2" Classes="icon_button" Width="18" Height="30" Click="ScrollTabsRight">
|
||||
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleRight}"/>
|
||||
</RepeatButton>
|
||||
|
||||
<Button x:Name="OuterNewTabBtn"
|
||||
Grid.Column="3"
|
||||
Classes="icon_button"
|
||||
Width="16" Height="16"
|
||||
Margin="8,0"
|
||||
Command="{Binding AddNewTab}">
|
||||
<ToolTip.Tip>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{DynamicResource Text.PageTabBar.New}" VerticalAlignment="Center"/>
|
||||
<TextBlock Margin="16,0,0,0" Text="{OnPlatform Ctrl+T, macOS=⌘+T}" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Plus}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace SourceGit.Views
|
|||
if (containerEndX < startX || containerEndX > endX)
|
||||
continue;
|
||||
|
||||
if (OuterNewTabBtn.IsVisible && i == count - 1)
|
||||
break;
|
||||
|
||||
var separatorX = containerEndX - startX + LauncherTabsScroller.Bounds.X;
|
||||
context.DrawLine(separatorPen, new Point(separatorX, separatorY), new Point(separatorX, separatorY + 20));
|
||||
}
|
||||
|
@ -88,7 +91,7 @@ namespace SourceGit.Views
|
|||
x = drawRightX - 6;
|
||||
}
|
||||
|
||||
if (drawRightX < LauncherTabsScroller.Bounds.Right)
|
||||
if (drawRightX <= LauncherTabsScroller.Bounds.Right)
|
||||
{
|
||||
ctx.LineTo(new Point(x, y));
|
||||
x = drawRightX;
|
||||
|
@ -146,11 +149,15 @@ namespace SourceGit.Views
|
|||
LeftScrollIndicator.IsEnabled = LauncherTabsScroller.Offset.X > 0;
|
||||
RightScrollIndicator.IsVisible = true;
|
||||
RightScrollIndicator.IsEnabled = LauncherTabsScroller.Offset.X < LauncherTabsScroller.Extent.Width - LauncherTabsScroller.Viewport.Width;
|
||||
InnerNewTabBtn.IsVisible = false;
|
||||
OuterNewTabBtn.IsVisible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeftScrollIndicator.IsVisible = false;
|
||||
RightScrollIndicator.IsVisible = false;
|
||||
InnerNewTabBtn.IsVisible = true;
|
||||
OuterNewTabBtn.IsVisible = false;
|
||||
}
|
||||
|
||||
InvalidateVisual();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue