sc/source/ui/view/select.cxx |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

New commits:
commit d47a28723ee5b8df2f9e34449b15fac7970a1c69
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Mar 15 16:54:44 2018 +0000

    Resolves: tdf#115923 try a different approach to solving tdf#46637
    
    Try scrolling to the cell the mouse is over if its not fully visible already
    and this is not autofill selection. To avoid the mouse over the autofill 
handle
    which overflows into neighbours scrolling the neighbour cell into view 
before
    its truly desired to be selected when the mouse passes the center point
    
    in other words, for autofill go back to how it always was
    
    Change-Id: I6f67ad0f49c2d4087949f71f38322f06ced13c79
    Reviewed-on: https://gerrit.libreoffice.org/51392
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index f06043c79276..fcfe6eddf1c5 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -321,13 +321,28 @@ bool ScViewFunctionSet::SetCursorAtPoint( const Point& 
rPointPixel, bool /* bDon
                                                  pEngine->GetWindow(),
                                                  nullptr, false);
 
-    bool bBottomScroll = ( aEditArea.Bottom() >= aWinSize.Height() );
-    bool bRightScroll  = ( aEditArea.Right() >= aWinSize.Width() );
+    bool bFillingSelection = pViewData->IsFillMode() || 
pViewData->GetFillMode() == ScFillMode::MATRIX;
+    bool bBottomScroll;
+    bool bRightScroll;
+    // for Autofill don't yet assume we want to auto-scroll to the cell under 
the mouse
+    // because the autofill handle extends into a cells neighbours so initial 
click is usually
+    // above a neighbour cell
+    if (bFillingSelection)
+    {
+        bBottomScroll = aEffPos.X() >= aWinSize.Height();
+        bRightScroll  = aEffPos.Y() >= aWinSize.Width();
+    }
+    else
+    {
+        //in the normal case make the full selected cell visible
+        bBottomScroll = aEditArea.Bottom() >= aWinSize.Height();
+        bRightScroll  = aEditArea.Right() >= aWinSize.Width();
+    }
+
     bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
 
-    // for Autofill switch in the center of cell
-    // thereby don't prevent scrolling to bottom/right
-    if ( pViewData->IsFillMode() || pViewData->GetFillMode() == 
ScFillMode::MATRIX )
+    // for Autofill switch in the center of cell thereby don't prevent 
scrolling to bottom/right
+    if (bFillingSelection)
     {
         bool bLeft, bTop;
         pViewData->GetMouseQuadrant( aEffPos, GetWhich(), nPosX, nPosY, bLeft, 
bTop );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to