diff options
author | Patrick Luby <plubius@libreoffice.org> | 2023-12-25 09:19:48 -0500 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-05 15:48:41 +0100 |
commit | 24effe0edd9ae1ea9e4dd8e0bdabd5f25e1b9a68 (patch) | |
tree | 31b16cee11b8e1ed3cda629bde19b29c86fdc6d1 /vcl | |
parent | d6606237eef8adab7906140e2269bdc86825d4aa (diff) |
tdf#135478 Reduce sensitivity of horizontal scrollwheel
Problem: at least on macOS, swipe events are very
precise. So, when swiping at a slight angle off of
vertical, swipe events will include a small amount
of horizontal movement. Since horizontal swipe units
are measured in cell widths, these small amounts of
horizontal movement results in shifting many columns
to the right or left while swiping almost vertically.
So my hacky fix is to reduce the amount of horizontal
swipe events to roughly match the "visual distance"
of vertical swipe events.
The reduction factor is arbitrary but is set to
roughly the ratio of default cell width divided by
default cell height. This hacky fix isn't a perfect
fix, but hopefully it reduces the amount of
unexpected horizontal shifting while swiping
vertically to a tolerable amount for most users.
Note: the potential downside of doing this is that
some users might find horizontal swiping to be
slower than they are used to. If that becomes an
issue for enough users, the reduction factor may
need to be lowered to find a good balance point.
Lastly, fix the unbalanced rounding of delta X and Y
values due to using floor() for macOS native swipe
and scroll wheel events.
Change-Id: I8c0c9a3aa688e411c47ebb5e7500f3a50f6f673b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161278
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Patrick Luby <plubius@libreoffice.org>
(cherry picked from commit 689ddab27bb0658e43ab0e0d4d8235e45d8904d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161317
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/osx/salframeview.mm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index c0b23f80a7d6..995eeb574999 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -1095,7 +1095,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) if( dX != 0.0 ) { - aEvent.mnDelta = static_cast<tools::Long>(floor(dX)); + aEvent.mnDelta = static_cast<tools::Long>(dX < 0 ? floor(dX) : ceil(dX)); aEvent.mnNotchDelta = (dX < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; @@ -1105,7 +1105,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) } if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame )) { - aEvent.mnDelta = static_cast<tools::Long>(floor(dY)); + aEvent.mnDelta = static_cast<tools::Long>(dY < 0 ? floor(dY) : ceil(dY)); aEvent.mnNotchDelta = (dY < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; @@ -1154,7 +1154,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) if( dX != 0.0 ) { - aEvent.mnDelta = static_cast<tools::Long>(floor(dX)); + aEvent.mnDelta = static_cast<tools::Long>(dX < 0 ? floor(dX) : ceil(dX)); aEvent.mnNotchDelta = (dX < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; @@ -1168,7 +1168,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) } if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) ) { - aEvent.mnDelta = static_cast<tools::Long>(floor(dY)); + aEvent.mnDelta = static_cast<tools::Long>(dY < 0 ? floor(dY) : ceil(dY)); aEvent.mnNotchDelta = (dY < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; |