-
-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Thanks for the really useful control! I found some issues when working with it, this is one of them:
Description of the issue:
When setting WheelBehaviorMode.PanVertical, vertical scrolling on mouse and touchpad work as expected. Horizontal scrolling should still be possible on the touchpad in this case though. That currently doesn't work.
When setting WheelBehaviorMode.PanHorizontal, horizontal scrolling doesn't work on mouse at all, because mouse scroll wheels only produce Delta.Y, not Delta.X. On the touchpad, it works, but only with horizontal movement on the touchpad.
| Device | Mode | Current | Expected |
|---|---|---|---|
| Mouse | PanVertical | ✓ Works | ✓ Works |
| Mouse | PanHorizontal | ✗ Nothing happens | Scroll → horizontal pan |
| Touchpad | PanVertical | ✗ Vertical only | Both axes |
| Touchpad | PanHorizontal | ✗ Horizontal only | Swapped axes |
Cause:
As far as I could pinpoint the issue, it seems to be between line 464 and 478 in ZoomBorder.cs. Here is the current code snippet:
case WheelBehaviorMode.PanVertical:
if (EnablePan)
{
PanDelta(0, 10 * e.Delta.Y * WheelPanSensitivity);
e.Handled = true;
}
break;
case WheelBehaviorMode.PanHorizontal:
if (EnablePan)
{
PanDelta(10 * e.Delta.X * WheelPanSensitivity, 0);
e.Handled = true;
}
break;Proposed solution:
I would recommend that we use both deltas like already done in the backward compatibility if WheelBehaviorMode.Zoom and zoom is disabled, but pan is enabled. I would then propose that when switching to panHorizontal, we just switch x- and y Delta. That way, with the mouse it behaves as expected, on the touchpad it would switch horizontal and vertical scrolling (natural and expected behaviour when pressing for example shift)
I would suggest this code snippet in place of the one above:
case WheelBehaviorMode.PanVertical:
if (EnablePan)
{
PanDelta(10 * e.Delta.X * WheelPanSensitivity, 10 * e.Delta.Y * WheelPanSensitivity);
e.Handled = true;
}
break;
case WheelBehaviorMode.PanHorizontal:
if (EnablePan)
{
PanDelta(10 * e.Delta.Y * WheelPanSensitivity, 10 * e.Delta.X * WheelPanSensitivity);
e.Handled = true;
}
break;What do you think? Would that work for you? Or does that have any side-effects that I don't currently see? I have experimented with my snippet and haven't encountered any issues. It works as expected.