summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRoman Kuznetsov <antilibreoffice@gmail.com>2020-04-26 20:49:22 +0100
committerRoman Kuznetsov <antilibreoffice@gmail.com>2020-04-29 11:21:13 +0200
commit6cd1591fb8b0a550067c37cf720708c6a5630b6d (patch)
tree3c22810f06d43d2c649b138581b333d97b0d4f80 /sfx2
parent2919bc15867a53a6db79f482d9ccb86ac2663b35 (diff)
tdf#132441 thumb scrolling in Start Center should be more accuracy
Change-Id: Iffee86c0046f5ec6dae0b0287ce098f9d821acaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92779 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/thumbnailview.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 61a7d8f0ba35..996aceae06b4 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -263,7 +263,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
float nScrollRatio;
if( bScrollBarUsed && mpScrBar )
nScrollRatio = static_cast<float>(mpScrBar->GetThumbPos()) /
- static_cast<float>(mpScrBar->GetRangeMax()-2);
+ static_cast<float>(mpScrBar->GetRangeMax() - mpScrBar->GetVisibleSize());
else
nScrollRatio = 0;
@@ -296,11 +296,10 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
mbHasVisibleItems = true;
+ long nFullSteps = (mnLines > mnVisLines) ? mnLines - mnVisLines + 1 : 1;
+
long nItemHeightOffset = mnItemHeight + nVItemSpace;
- long nHiddenLines = (static_cast<long>(
- ( mnLines - 1 ) * nItemHeightOffset * nScrollRatio ) -
- nVItemSpace ) /
- nItemHeightOffset;
+ long nHiddenLines = static_cast<long>((nFullSteps - 1) * nScrollRatio);
// calculate offsets
long nStartX = nHItemSpace;
@@ -308,8 +307,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
// calculate and draw items
long x = nStartX;
- long y = nStartY - ( mnLines - 1 ) * nItemHeightOffset * nScrollRatio +
- nHiddenLines * nItemHeightOffset;
+ long y = nStartY - ((nFullSteps - 1) * nScrollRatio - nHiddenLines) * nItemHeightOffset;
// draw items
// Unless we are scrolling (via scrollbar) we just use the precalculated
@@ -387,8 +385,8 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
Size aSize( nScrBarWidth, aWinSize.Height() );
mpScrBar->SetPosSizePixel( aPos, aSize );
- mpScrBar->SetRangeMax( (nCurCount+mnCols-1)*gnFineness/mnCols);
- mpScrBar->SetVisibleSize( mnVisLines );
+ mpScrBar->SetRangeMax(mnLines * gnFineness);
+ mpScrBar->SetVisibleSize(mnVisLines * gnFineness);
if (!bScrollBarUsed)
mpScrBar->SetThumbPos( static_cast<long>(mnFirstLine)*gnFineness );
long nPageSize = mnVisLines;