Skip to content

Commit

Permalink
Use the correct scale when drawing the text annotation (#12093)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Mar 8, 2024
1 parent abf6afd commit 645976b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions OMEdit/OMEditLIB/Annotations/TextAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ void TextAnnotation::drawAnnotation(QPainter *painter)
const qreal m21 = painterTransform.m21();
qreal xScale = qSqrt(m11*m11 + m12*m12);
qreal yScale = qSqrt(m22*m22 + m21*m21);
qreal curScale = qMin(xScale, yScale);
// set new transformation for the text based on rotation or scale.
qreal invx = (m11 >= 0) ? 1.0 : -1.0;
qreal invy = (m22 >= 0) ? 1.0 : -1.0;
Expand All @@ -401,7 +400,7 @@ void TextAnnotation::drawAnnotation(QPainter *painter)
QRectF boundingRectangle = boundingRect();
qreal xtl = (invx >= 0) ? boundingRectangle.left() : -boundingRectangle.right();
qreal ytl = (invy >= 0) ? boundingRectangle.top() : -boundingRectangle.bottom();
QRectF mappedBoundingRect = QRectF(xtl * curScale, ytl * curScale, boundingRectangle.width() * curScale, boundingRectangle.height() * curScale);
QRectF mappedBoundingRect = QRectF(xtl * xScale, ytl * yScale, boundingRectangle.width() * xScale, boundingRectangle.height() * yScale);
// normalize the text for drawing
QString textString = StringHandler::removeFirstLastQuotes(mTextString);
textString = StringHandler::unparse(QString("\"").append(mTextString).append("\""));
Expand Down

0 comments on commit 645976b

Please sign in to comment.