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.tietze@documentfoundation.org>
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 543a60a..2404ea4 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;