sfx2/source/control/thumbnailview.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
New commits: commit 6cd1591fb8b0a550067c37cf720708c6a5630b6d Author: Roman Kuznetsov <antilibreoff...@gmail.com> AuthorDate: Sun Apr 26 20:49:22 2020 +0100 Commit: Roman Kuznetsov <antilibreoff...@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.kagan...@collabora.com> Reviewed-by: Roman Kuznetsov <antilibreoff...@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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits