mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
Merge pull request #124 from gadfly3173/fix/launcher-tab
Enhance launcherTabsScroller scroll behavior
This commit is contained in:
commit
1b2f556b88
3 changed files with 19 additions and 9 deletions
|
@ -230,16 +230,16 @@
|
||||||
<Setter Property="Background" Value="Red"/>
|
<Setter Property="Background" Value="Red"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="Button.icon_button">
|
<Style Selector="Button.icon_button, RepeatButton.icon_button">
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Button.icon_button /template/ ContentPresenter#PART_ContentPresenter">
|
<Style Selector="Button.icon_button /template/ ContentPresenter#PART_ContentPresenter, RepeatButton.icon_button /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="Opacity" Value="0.8"/>
|
<Setter Property="Opacity" Value="0.8"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Button.icon_button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
<Style Selector="Button.icon_button:pointerover /template/ ContentPresenter#PART_ContentPresenter, RepeatButton.icon_button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Opacity" Value="1"/>
|
<Setter Property="Opacity" Value="1"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,9 @@
|
||||||
|
|
||||||
<!-- Pages Tabs-->
|
<!-- Pages Tabs-->
|
||||||
<Grid x:Name="launcherTabsContainer" Grid.Column="1" Height="30" ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Bottom" SizeChanged="UpdateScrollIndicator">
|
<Grid x:Name="launcherTabsContainer" Grid.Column="1" Height="30" ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Bottom" SizeChanged="UpdateScrollIndicator">
|
||||||
<Button x:Name="leftScrollIndicator" Grid.Column="0" Classes="icon_button" Width="18" Height="30" Click="ScrollTabsLeft">
|
<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}"/>
|
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||||
</Button>
|
</RepeatButton>
|
||||||
|
|
||||||
<ScrollViewer Grid.Column="1"
|
<ScrollViewer Grid.Column="1"
|
||||||
x:Name="launcherTabsScroller"
|
x:Name="launcherTabsScroller"
|
||||||
|
@ -96,7 +96,8 @@
|
||||||
VerticalScrollBarVisibility="Disabled"
|
VerticalScrollBarVisibility="Disabled"
|
||||||
DoubleTapped="MaximizeOrRestoreWindow"
|
DoubleTapped="MaximizeOrRestoreWindow"
|
||||||
PointerPressed="BeginMoveWindow"
|
PointerPressed="BeginMoveWindow"
|
||||||
PointerWheelChanged="ScrollTabs">
|
PointerWheelChanged="ScrollTabs"
|
||||||
|
ScrollChanged="OnTabsScrollChanged">
|
||||||
<StackPanel x:Name="launcherTabsBar" Orientation="Horizontal" SizeChanged="UpdateScrollIndicator">
|
<StackPanel x:Name="launcherTabsBar" Orientation="Horizontal" SizeChanged="UpdateScrollIndicator">
|
||||||
<ListBox Classes="launcher_page_tabbar"
|
<ListBox Classes="launcher_page_tabbar"
|
||||||
ItemsSource="{Binding Pages}"
|
ItemsSource="{Binding Pages}"
|
||||||
|
@ -240,9 +241,9 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
<Button x:Name="rightScrollIndicator" Grid.Column="2" Classes="icon_button" Width="18" Height="30" Click="ScrollTabsRight">
|
<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}"/>
|
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleRight}"/>
|
||||||
</Button>
|
</RepeatButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Caption Buttons (Windows/Linux)-->
|
<!-- Caption Buttons (Windows/Linux)-->
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
if (e.Delta.Y < 0)
|
if (e.Delta.Y < 0)
|
||||||
launcherTabsScroller.LineRight();
|
launcherTabsScroller.LineRight();
|
||||||
else
|
else if (e.Delta.Y > 0)
|
||||||
launcherTabsScroller.LineLeft();
|
launcherTabsScroller.LineLeft();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -265,6 +265,15 @@ namespace SourceGit.Views
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTabsScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is ScrollViewer scrollViewer)
|
||||||
|
{
|
||||||
|
leftScrollIndicator.IsEnabled = scrollViewer.Offset.X > 0;
|
||||||
|
rightScrollIndicator.IsEnabled = scrollViewer.Offset.X < scrollViewer.Extent.Width - scrollViewer.Viewport.Width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SetupDragAndDrop(object sender, RoutedEventArgs e)
|
private void SetupDragAndDrop(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Border border)
|
if (sender is Border border)
|
||||||
|
|
Loading…
Reference in a new issue