Skip to content

Commit

Permalink
raise cloned pointer wheel event in scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
emmauss committed Jul 31, 2024
1 parent 95b9369 commit 53790d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Avalonia.Controls/Primitives/ScrollBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 53790d2

Please sign in to comment.