vcl/source/window/window2.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit b788be3f380d36f38bb1a0eefade110f40c855b4
Author:     Tibor Nagy <tibor.nagy.ext...@allotropia.de>
AuthorDate: Sun Jul 28 10:28:54 2024 +0200
Commit:     Nagy Tibor <tibor.nagy.ext...@allotropia.de>
CommitDate: Mon Jul 29 12:24:36 2024 +0200

    tdf#85677: fix the vertical panning gesture in Impress
    
    Change-Id: I574f802e5f7de260ecb56032098e60018f2675da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171137
    Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de>
    Tested-by: Jenkins

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c9fbad68842f..c17232fcbeab 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -812,21 +812,23 @@ bool Window::HandleScrollCommand( const CommandEvent& 
rCmd,
                             bool bContains = aWinRect.Contains(aGesturePt);
                             if (bContains)
                             {
-                                tools::Long nOriginalPos
-                                    = bHorz ? 
mpWindowImpl->mpFrameData->mnTouchPanPositionX
-                                            : 
mpWindowImpl->mpFrameData->mnTouchPanPositionY;
-
-                                tools::Long nNewPos;
-                                double nOffset = pData->mfOffset;
-                                tools::Long nSize = pScrl->GetVisibleSize();
-                                if (aWinRect.GetSize().Width() < nSize
-                                    || aWinRect.GetSize().Height() < nSize)
+                                double nWinSize;
+                                tools::Long nOriginalPos;
+                                if (bHorz)
                                 {
-                                    sal_Int32 nVelocity = 15;
-                                    nNewPos = nOriginalPos - (nOffset * 
nVelocity);
+                                    nWinSize = GetOutputSizePixel().getWidth();
+                                    nOriginalPos = 
mpWindowImpl->mpFrameData->mnTouchPanPositionX;
                                 }
                                 else
-                                    nNewPos = nOriginalPos - (nOffset / nSize);
+                                {
+                                    nWinSize = 
GetOutputSizePixel().getHeight();
+                                    nOriginalPos = 
mpWindowImpl->mpFrameData->mnTouchPanPositionY;
+                                }
+                                double nOffset = pData->mfOffset;
+                                double nRatio = nOffset / nWinSize;
+                                tools::Long nVisibleSize = 
pScrl->GetVisibleSize();
+                                tools::Long nDeltaInLogic = 
tools::Long(nVisibleSize * nRatio);
+                                tools::Long nNewPos = nOriginalPos - 
nDeltaInLogic;
 
                                 pScrl->DoScroll(nNewPos);
                             }

Reply via email to