Commit 44b7ca2c authored by Juan Palacios's avatar Juan Palacios
Browse files

Fixed aspect ratio computation of artistic text shape

Aspect ratio was not being computed correctly. Now artistic shape
maintain the aspect ratio of the box used to define the text area,
keeping the defined height and extending the width to accommodate the
predefined text.

CCBUG: 305323
parent b69f9706
...@@ -110,8 +110,8 @@ void KisToolText::finishRect(const QRectF &rect) ...@@ -110,8 +110,8 @@ void KisToolText::finishRect(const QRectF &rect)
shape->setPosition(r.topLeft()); shape->setPosition(r.topLeft());
// If the shape is an artistic shape we keep the aspect ratio so the text isn't stretched // If the shape is an artistic shape we keep the aspect ratio so the text isn't stretched
if (shapeString == "ArtisticText") { if (shapeString == "ArtisticText") {
qreal ratio = rect.height()/shape->size().height(); qreal ratio = shape->size().width() / shape->size().height();
r.setWidth(shape->size().width()*ratio); r.setWidth(convertToPt(rect).height() * ratio);
} }
shape->setSize(r.size()); shape->setSize(r.size());
addShape(shape); addShape(shape);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment