Merge pull request #940 from manongjohn/fix_high_res_check_indicators

Fix small text on high res monitors
This commit is contained in:
manongjohn 2022-04-01 06:50:14 -04:00 committed by GitHub
commit d6ae9a0860
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -30,6 +30,7 @@
// TnzQt includes
#include "toonzqt/selection.h"
#include "toonzqt/selectioncommandids.h"
#include "toonzqt/gutil.h"
// TnzTools includes
#include "tools/tool.h"
@ -1263,7 +1264,8 @@ void SkeletonTool::drawDrawingBrowser(const TXshCell &cell,
std::to_string(cell.m_frameId.getNumber());
QString qText = QString::fromStdString(name);
QFont font("Arial", 10); // ,QFont::Bold);
int devPixRatio = getDevicePixelRatio(getViewer()->viewerWidget());
QFont font("Arial", 10 * devPixRatio); // ,QFont::Bold);
QFontMetrics fm(font);
QSize textSize = fm.boundingRect(qText).size();
int arrowHeight = 10;

View file

@ -8,6 +8,7 @@
#include "toonz/txshlevelhandle.h"
#include "toonz/tscenehandle.h"
#include "toonzqt/selectioncommandids.h"
#include "toonzqt/gutil.h"
#include "toonzqt/selection.h"
#include "tproperty.h"
@ -287,6 +288,7 @@ void TrackerTool::draw() {
selectedObjectId = -1;
int i = 0;
double pixelSize = getPixelSize();
int devPixRatio = getDevicePixelRatio(m_viewer->viewerWidget());
std::vector<TRectD> balloons; // this is used to avoid balloons overlapping
// draw hooks
@ -324,7 +326,7 @@ void TrackerTool::draw() {
tglColor(textColor);
glPushMatrix();
glTranslated(hook->getPos(fid).x, hook->getPos(fid).y, 0);
glScaled(pixelSize, pixelSize, 1);
glScaled(pixelSize * devPixRatio, pixelSize * devPixRatio, 1);
int objectId = hook->getTrackerObjectId();
std::string text({static_cast<char>('A' + objectId)});
tglDrawText(TPointD(-15, 10), text);

View file

@ -1891,13 +1891,15 @@ void SceneViewer::drawViewerIndicators() {
if (!checkTexts.size()) return;
int devPixRatio = getDevPixRatio();
int x0, x1, y0, y1;
rect().getCoords(&x0, &y0, &x1, &y1);
x0 = (-(x1 / 2)) + 15;
y0 = ((y1 / 2)) - 25;
x0 = (-(x1 / (2 * devPixRatio))) + 15;
y0 = ((y1 / (2 * devPixRatio))) - 25;
glPushMatrix();
glScaled(2, 2, 2);
glScaled(2 * devPixRatio, 2 * devPixRatio, 2 * devPixRatio);
glColor3d(1.0, 0.0, 0.0);
for (int i = 0; i < checkTexts.size(); i++) {
int y = (y0 / 2) - (i * 10);