sc/source/ui/view/tabview.cxx | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
New commits: commit 063b64d0ad31a68a13da0ee0803a7016890b7b28 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Thu Aug 29 21:07:20 2024 -0400 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Sat Sep 7 21:21:06 2024 +0200 tdf#161945 increase sensitivity for negative horizontal deltas A side effect of the anti-jitter code is that it tends to reduce the sensitivity of horizontal scroll events towards the first column. It is particularly noticeable with horizontal scroll events from a scrollwheel when the view position is in column B or C. This results in a very small delta from the anti-jitter code. So, to balance things out, apply a constant adjustment factor to increase the sensitivity more for small deltas than for large deltas. Also, while the fix for tdf#135478 reduces the horizontal scroll delta applied to the tab view, the horizontal scrollbar is set before that with the original delta. As a result, the horizontal scrollbar is now mispositioned so update the horizontal scrollbar position to match the position of the tab view's visible columns. Change-Id: I4be66c40692d4b92557f31235339ac6c40755ae7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172619 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomac...@gmail.com> (cherry picked from commit 50d373a275626d894dc885d4c2cc28a9f9b8b912) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173005 Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 8eba950c48ce..163d220af5e1 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1089,6 +1089,8 @@ IMPL_LINK_NOARG(ScTabView, EndScrollHdl, const MouseEvent&, bool) void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) { + bool bUpdateHorizontalScrollbars = false; + bool bHoriz = ( pScroll == aHScrollLeft.get() || pScroll == aHScrollRight.get() ); tools::Long nViewPos; if ( bHoriz ) @@ -1266,7 +1268,22 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) // 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. - static const sal_uInt16 nHScrollReductionFactor = 8; + static const tools::Long nHScrollReductionFactor = 8; + + // tdf#161945 increase sensitivity for negative horizontal deltas + // A side effect of the anti-jitter code is that it tends + // to reduce the sensitivity of horizontal scroll events + // towards the first column. It is particularly noticeable + // with horizontal scroll events from a scrollwheel when + // the view position is in column B or C. This results in + // a very small delta from the anti-jitter code. + // So, to balance things out, apply a constant adjustment + // factor to increase the sensitivity more for small deltas + // than for large deltas. + static const tools::Long nHScrollNegativeDeltaAdjustmentFactor = -1; + if ( nDelta < 0 ) + nDelta += nHScrollNegativeDeltaAdjustmentFactor; + if ( pScroll == aHScrollLeft.get() ) { mnPendingaHScrollLeftDelta += nDelta; @@ -1277,7 +1294,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) mnPendingaHScrollLeftDelta = mnPendingaHScrollLeftDelta % nHScrollReductionFactor; } } - else if ( pScroll == aHScrollRight.get() ) + else { mnPendingaHScrollRightDelta += nDelta; nDelta = 0; @@ -1287,6 +1304,8 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) mnPendingaHScrollRightDelta = mnPendingaHScrollRightDelta % nHScrollReductionFactor; } } + + bUpdateHorizontalScrollbars = true; } nPrevDragPos = nScrollPos; @@ -1302,6 +1321,15 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) else ScrollY( nDelta, (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate ); } + + // tdf#161945 update horizontal scrollbar position to match tab view + // While the fix for tdf#135478 reduces the horizontal scroll delta + // applied to the tab view, the horizontal scrollbar is set before + // that with the original delta. As a result, the horizontal scrollbar + // is now mispositioned so update the horizontal scrollbar position + // to match the position of the tab view's visible columns. + if ( bUpdateHorizontalScrollbars ) + UpdateScrollBars( COLUMN_HEADER ); } void ScTabView::ScrollX( tools::Long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )