Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Views/LauncherTabBar.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Classes="icon_button"
Width="18" Height="28"
Margin="0,2,0,0"
Click="ScrollTabsLeft"
Click="OnScrollTabsLeft"
IsVisible="{Binding #ThisControl.IsScrollerVisible}">
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleLeft}"/>
</RepeatButton>
Expand All @@ -26,7 +26,7 @@
HorizontalAlignment="Left"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Disabled"
PointerWheelChanged="ScrollTabs">
PointerWheelChanged="OnScrollTabs">
<StackPanel Orientation="Horizontal">
<ListBox x:Name="LauncherTabsList"
Classes="launcher_page_tabbar"
Expand Down Expand Up @@ -148,7 +148,7 @@
</ScrollViewer>

<StackPanel Grid.Column="2" Orientation="Horizontal" IsVisible="{Binding #ThisControl.IsScrollerVisible}">
<RepeatButton Classes="icon_button" Width="18" Height="28" Margin="0,2,0,0" Click="ScrollTabsRight">
<RepeatButton Classes="icon_button" Width="18" Height="28" Margin="0,2,0,0" Click="OnScrollTabsRight">
<Path Width="8" Height="14" Stretch="Fill" Data="{StaticResource Icons.TriangleRight}"/>
</RepeatButton>

Expand Down
32 changes: 25 additions & 7 deletions src/Views/LauncherTabBar.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,30 +162,48 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
InvalidateVisual();
}

private void ScrollTabs(object _, PointerWheelEventArgs e)
private void OnScrollTabs(object _, PointerWheelEventArgs e)
{
if (!e.KeyModifiers.HasFlag(KeyModifiers.Shift))
{
var lines = e.Pointer.Type switch
{
PointerType.Mouse => 3,
_ => 1
};

if (e.Delta.Y < 0)
LauncherTabsScroller.LineRight();
ScrollTabsRight(lines);
else if (e.Delta.Y > 0)
LauncherTabsScroller.LineLeft();
ScrollTabsLeft(lines);
e.Handled = true;
}
}

private void ScrollTabsLeft(object _, RoutedEventArgs e)
private void OnScrollTabsLeft(object _, RoutedEventArgs e)
{
LauncherTabsScroller.LineLeft();
ScrollTabsLeft(3);
e.Handled = true;
}

private void ScrollTabsRight(object _, RoutedEventArgs e)
private void OnScrollTabsRight(object _, RoutedEventArgs e)
{
LauncherTabsScroller.LineRight();
ScrollTabsRight(3);
e.Handled = true;
}

private void ScrollTabsLeft(int lines)
{
for (var i = 0; i < lines; i++)
LauncherTabsScroller.LineLeft();
}

private void ScrollTabsRight(int lines)
{
for (var i = 0; i < lines; i++)
LauncherTabsScroller.LineRight();
}

private void OnTabsLayoutUpdated(object _1, EventArgs _2)
{
SetCurrentValue(IsScrollerVisibleProperty, LauncherTabsScroller.Extent.Width > LauncherTabsScroller.Viewport.Width);
Expand Down