diff --git a/src/Views/LauncherTabBar.axaml b/src/Views/LauncherTabBar.axaml index 7394e5d78..7031b6a83 100644 --- a/src/Views/LauncherTabBar.axaml +++ b/src/Views/LauncherTabBar.axaml @@ -15,7 +15,7 @@ Classes="icon_button" Width="18" Height="28" Margin="0,2,0,0" - Click="ScrollTabsLeft" + Click="OnScrollTabsLeft" IsVisible="{Binding #ThisControl.IsScrollerVisible}"> @@ -26,7 +26,7 @@ HorizontalAlignment="Left" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled" - PointerWheelChanged="ScrollTabs"> + PointerWheelChanged="OnScrollTabs"> - + diff --git a/src/Views/LauncherTabBar.axaml.cs b/src/Views/LauncherTabBar.axaml.cs index 989fdaf02..bc0739319 100644 --- a/src/Views/LauncherTabBar.axaml.cs +++ b/src/Views/LauncherTabBar.axaml.cs @@ -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);