diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-03-21 14:30:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-03-21 20:21:36 +0000 |
commit | f2b97ecf340e1fd714c636060ae09382518a2b46 (patch) | |
tree | d5fc2b86b4bf2d7c2e7e920888b46de7b0759662 /sc/source/ui/view/tabview.cxx | |
parent | 24d2e8ea7a17ded531d19cba3f1cb30b17833eea (diff) |
unmerge default and ScrollType::Drag cases for calc scrollbars
before:
commit 8c4e8818fe9f5ac1f6cdf908299cc109d67f1e50
Author: Caolán McNamara <caolanm@redhat.com>
Date: Thu Aug 4 16:38:47 2022 +0100
nDelta overwritten on all branches except default
the default case was different to the Drag case, and tdf#152406
uncovers a problem using the Drag case for scroll wheel, so undo
the merge of default of Drag.
Change-Id: I7471191d5e1f50f74563e8bcbcb82127d94edf2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149228
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/tabview.cxx')
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9142393a9152..dea6dbb7810d 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1170,7 +1170,6 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) if ( pScroll == aVScrollBottom.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=1; break; - default: // added to avoid warnings case ScrollType::Drag: { // only scroll in the correct direction, do not jitter around hidden ranges @@ -1182,31 +1181,30 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) tools::Long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; nDelta = nScrollPos - nViewPos; - - // tdf#152406 Disable anti-jitter code for scroll wheel events - // After moving thousands of columns to the right via - // horizontal scroll wheel or trackpad swipe events, most - // vertical scroll wheel or trackpad swipe events will trigger - // the anti-jitter code because nScrollPos and nPrevDragPos - // will be equal and nDelta will be overriden and set to zero. - // So, only use the anti-jitter code for mouse drag events. - if ( eType == ScrollType::Drag ) + if ( nScrollPos > nPrevDragPos ) { - if ( nScrollPos > nPrevDragPos ) - { - if (nDelta<0) nDelta=0; - } - else if ( nScrollPos < nPrevDragPos ) - { - if (nDelta>0) nDelta=0; - } - else - nDelta = 0; + if (nDelta<0) nDelta=0; } - + else if ( nScrollPos < nPrevDragPos ) + { + if (nDelta>0) nDelta=0; + } + else + nDelta = 0; nPrevDragPos = nScrollPos; } break; + default: + // Note tdf#152406 no anti-jitter code, unlike ScrollType::Drag, + // for scroll wheel events. + // After moving thousands of columns to the right via horizontal + // scroll wheel or trackpad swipe events, most vertical scroll + // wheel or trackpad swipe events would trigger the anti-jitter + // code because nScrollPos and nPrevDragPos would be equal and + // nDelta will be overriden and set to zero. So, only use the + // anti-jitter code for mouse drag events. + nDelta = GetScrollBarPos(*pScroll) - nViewPos; + break; } if (nDelta) |