From 53790d22e3e9cefced0825b34473180ae09fc848 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Wed, 31 Jul 2024 10:44:25 +0000 Subject: [PATCH] raise cloned pointer wheel event in scrollbar --- src/Avalonia.Controls/Primitives/ScrollBar.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/ScrollBar.cs b/src/Avalonia.Controls/Primitives/ScrollBar.cs index bc89faa4021..7df7012f8f7 100644 --- a/src/Avalonia.Controls/Primitives/ScrollBar.cs +++ b/src/Avalonia.Controls/Primitives/ScrollBar.cs @@ -262,8 +262,18 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) base.OnPointerWheelChanged(e); // We need to handle pointer wheel event to allow scrolling with the pointer wheel. So we raise the event on the scrollviewer's presenter - if(!e.Handled && _owner?.Presenter is { } presenter) + if (!e.Handled && _owner?.Presenter is { } presenter && VisualRoot is Visual root) { + e.Handled = true; + e = new PointerWheelEventArgs( + this, + e.Pointer, + root, + e.GetPosition(root), + e.Timestamp, + new PointerPointProperties((RawInputModifiers)e.KeyModifiers, PointerUpdateKind.Other), + e.KeyModifiers, + e.Delta); presenter.RaiseEvent(e); } }