Sat, 05 Mar 2022 13:59:54 +0200
Fix rendering of cursor coordinates on bright background
src/ui/canvas.cpp | file | annotate | diff | comparison | revisions | |
src/ui/canvas.h | file | annotate | diff | comparison | revisions |
--- a/src/ui/canvas.cpp Sat Mar 05 13:55:12 2022 +0200 +++ b/src/ui/canvas.cpp Sat Mar 05 13:59:54 2022 +0200 @@ -152,11 +152,10 @@ { QPainter painter{this}; painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(Qt::black); + painter.setPen(this->isDark ? Qt::white : Qt::black); painter.setBrush(Qt::green); const QPointF pos = this->modelToScreenCoordinates(*this->worldPosition); painter.drawEllipse(pos, 5, 5); - painter.setPen(Qt::white); painter.drawText(pos + QPointF{5, 5}, vectorToString(*this->worldPosition)); } { @@ -340,10 +339,10 @@ void Canvas::updateCanvasRenderPreferences() { + this->isDark = luma(this->renderPreferences.backgroundColor) < 0.25; if (this->gridProgram.has_value()) { - const bool isDark = luma(this->renderPreferences.backgroundColor) < 0.25; - this->gridProgram->setGridColor(isDark ? Qt::white : Qt::black); + this->gridProgram->setGridColor(this->isDark ? Qt::white : Qt::black); } }