sfx2/source/control/thumbnailview.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
New commits: commit 4bea7a17056770c83006048f9fd3fa252958718b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Oct 20 19:42:58 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Oct 21 15:07:25 2020 +0200 mirror changes of ThumbnailView to SfxThumbnailView in advance of replacement commit 6cd1591fb8b0a550067c37cf720708c6a5630b6d Author: Roman Kuznetsov <antilibreoff...@gmail.com> Date: Sun Apr 26 20:49:22 2020 +0100 tdf#132441 thumb scrolling in Start Center should be more accuracy Change-Id: I9e267adcbed9c4ccd7ee8632b0c921a4809737d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104575 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 97235330b81b..fa1f2d26d7a8 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -1409,8 +1409,11 @@ void SfxThumbnailView::CalculateItemPositions(bool bScrollBarUsed) // calculate window scroll ratio float nScrollRatio; if (bScrollBarUsed) + { nScrollRatio = static_cast<float>(mxScrolledWindow->vadjustment_get_value()) / - static_cast<float>(mxScrolledWindow->vadjustment_get_upper()-2); + static_cast<float>(mxScrolledWindow->vadjustment_get_upper() - + mxScrolledWindow->vadjustment_get_page_size()); + } else nScrollRatio = 0; @@ -1448,11 +1451,10 @@ void SfxThumbnailView::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; @@ -1460,8 +1462,7 @@ void SfxThumbnailView::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 @@ -1536,8 +1537,8 @@ void SfxThumbnailView::CalculateItemPositions(bool bScrollBarUsed) // check if scroll is needed mbScroll = mnLines > mnVisLines; - mxScrolledWindow->vadjustment_set_upper((nCurCount+mnCols-1)*gnFineness/mnCols); - mxScrolledWindow->vadjustment_set_page_size(mnVisLines*gnFineness); + mxScrolledWindow->vadjustment_set_upper(mnLines * gnFineness); + mxScrolledWindow->vadjustment_set_page_size(mnVisLines * gnFineness); if (!bScrollBarUsed) mxScrolledWindow->vadjustment_set_value(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