[Libreoffice-commits] core.git: sfx2/source
Roman Kuznetsov (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 29 09:21:46 UTC 2020
sfx2/source/control/thumbnailview.cxx | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
New commits:
commit 6cd1591fb8b0a550067c37cf720708c6a5630b6d
Author: Roman Kuznetsov <antilibreoffice at gmail.com>
AuthorDate: Sun Apr 26 20:49:22 2020 +0100
Commit: Roman Kuznetsov <antilibreoffice at gmail.com>
CommitDate: Wed Apr 29 11:21:13 2020 +0200
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 at collabora.com>
Reviewed-by: Roman Kuznetsov <antilibreoffice at gmail.com>
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;
More information about the Libreoffice-commits
mailing list