Skip to content

Commit 088b88b

Browse files
committed
fix for drawText to avoid double translation when in a group
1 parent e75e6af commit 088b88b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

client-api/C++/examples/all_commands.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ int main()
307307

308308
// Testing VIbes drawText function
309309
VIBES_TEST( vibes::newFigure("drawText") );
310-
VIBES_TEST( vibes::drawText(2,-1,"My Text") );
310+
VIBES_TEST( vibes::newGroup("group") );
311+
VIBES_TEST( vibes::drawText(2,-1,"My Text"));
312+
VIBES_TEST( vibes::drawText(2,-2,"My Text",vibesParams("group","group"))) ;
311313
VIBES_TEST( vibes::drawText(2,2,"My Text", 0.1 , "b[k]") );
312314
VIBES_TEST( vibes::drawText(3,6,"My Text",vibesParams("FaceColor","red","EdgeColor","black","fontSize",15,"fontName","Cursive","name","Text") ) );
313315

viewer/vibesgraphicsitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,6 @@ bool VibesGraphicsText::parseJsonGraphics(const QJsonObject& json)
10411041
// #define GET_WITH_DEFAULT(dict,key,type,default_value) \
10421042
// dict.contains[key] ? dict[key].type
10431043

1044-
10451044
bool VibesGraphicsText::computeProjection(int dimX, int dimY)
10461045
{
10471046
const QJsonObject & json = this->_json;
@@ -1068,7 +1067,8 @@ bool VibesGraphicsText::computeProjection(int dimX, int dimY)
10681067
{
10691068
QFont textFont(fontName, fontSize);
10701069
this->setFont(textFont);
1071-
this->setTransform(QTransform(1, 0, 0, -1, pos[0].toDouble(), pos[1].toDouble() + scale));
1070+
this->setTransform(QTransform(1, 0, 0, -1, 0., 0.));
1071+
this->setPos(pos[0].toDouble(), pos[1].toDouble() + scale);
10721072
this->setText(text);
10731073
this->setPen(pen);
10741074
this->setBrush(brush);

0 commit comments

Comments
 (0)