diff options
author | Alexander V. Wolf <alex.v.wolf@gmail.com> | 2022-01-15 19:36:54 +0700 |
---|---|---|
committer | Alexander V. Wolf <alex.v.wolf@gmail.com> | 2022-01-15 19:36:54 +0700 |
commit | 52783a9ae84d8884b4f36e4d452a9d555cffdda8 (patch) | |
tree | 86c17fd0cd0a3ca97370ade5c256044194fb3a0e | |
parent | 9adf4ca96f94febbb53fceb6927b736ba5b9430f (diff) |
Fixed rendering gravity labels on HiDPI devices
-rw-r--r-- | src/core/StelPainter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/StelPainter.cpp b/src/core/StelPainter.cpp index 49825f8020..df67a65d89 100644 --- a/src/core/StelPainter.cpp +++ b/src/core/StelPainter.cpp @@ -553,11 +553,12 @@ void StelPainter::drawTextGravity180(float x, float y, const QString& ws, float if (d>qMax(prj->viewportXywh[3], prj->viewportXywh[2])*2 || ws.isEmpty()) return; + float ppx = static_cast<float>(prj->getDevicePixelsPerPixel()); float cWidth = static_cast<float>(getFontMetrics().boundingRect(ws).width())/ws.length(); float stdWidth = static_cast<float>(getFontMetrics().boundingRect("a").width()); theta = std::atan2(dy - 1, dx); theta_o = M_PIf + std::atan2(dx, dy - 1); - psi = std::atan2(cWidth, d + 1) * M_180_PIf; + psi = std::atan2(ppx*cWidth, d + 1) * M_180_PIf; if (psi>5) psi = 5; |