sc/source/ui/view/gridwin.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
New commits: commit c32994e22ff291b0227ed74de6d0d050cf0901c8 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Mon Jan 10 13:08:47 2022 +0100 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Mon Jan 17 08:45:52 2022 +0100 Resolves tdf#143733 - Make selection border wider Border width and handle size follow the zoom factor now Border is drawn evenly inside and outside the rectangle Change-Id: I83cfb8a8156e2f0346ded3e2abed4386d4006d00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128222 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 543a60abb673..2404ea47dd29 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6475,9 +6475,15 @@ void ScGridWindow::UpdateCursorOverlay() std::vector< basegfx::B2DRange > aRanges; const basegfx::B2DHomMatrix aTransform(GetOutDev()->GetInverseViewTransformation()); + // tdf#143733, tdf#145080 - improve border visibility + // constants picked for maximum consistency at 100% and adequate response on zoom + // line width = 1.5 at 100% (0.75 left +/- 0.75 right), 50% = 1, 200% = 1.25, 400% = 2.25 + const double MinSize = 0.25 * GetDPIScaleFactor(); + double fZoom(mrViewData.GetZoomX() * 0.5); for(const tools::Rectangle & rRA : aPixelRects) { - basegfx::B2DRange aRB(rRA.Left(), rRA.Top(), rRA.Right() + 1, rRA.Bottom() + 1); + basegfx::B2DRange aRB(rRA.Left() - MinSize - fZoom, rRA.Top() - MinSize - fZoom, + rRA.Right() + MinSize + fZoom, rRA.Bottom() + MinSize + fZoom); aRB.transform(aTransform); aRanges.push_back(aRB); } @@ -6632,9 +6638,13 @@ void ScGridWindow::UpdateAutoFillOverlay() ScDocument& rDoc = mrViewData.GetDocument(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); - float fScaleFactor = GetDPIScaleFactor(); + // tdf#143733 tdf#145080 - improve border visibility + // constants picked for maximum consistency at 100% + // size = 6 at 100% (as before), 50% = 4.5, 200% = 9, 400% = 15 + const float fScaleFactor = 3 * GetDPIScaleFactor(); + const double fZoom(3 * mrViewData.GetZoomX()); // Size should be even - Size aFillHandleSize(6 * fScaleFactor, 6 * fScaleFactor); + Size aFillHandleSize(fZoom + fScaleFactor, fZoom + fScaleFactor); Point aFillPos = mrViewData.GetScrPos( nX, nY, eWhich, true ); tools::Long nSizeXPix;