r18737 by fschmid - Follow-up to Bug #11964: Arrow heads in VDX files don't survive import

scribus-commit scribus-commit at lists.scribus.net
Thu Jan 16 21:29:28 UTC 2014


Author: fschmid
Date: Thu Jan 16 21:29:28 2014
New Revision: 18737

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18737
Log:
Follow-up to Bug #11964: Arrow heads in VDX files don't survive import
better placement of Arrow heads.

Modified:
    trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp

Modified: trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18737&path=/trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp Thu Jan 16 21:29:28 2014
@@ -1327,19 +1327,22 @@
 				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
 				{
 					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+					QPointF refP = QPointF(br.width() / 2.0, 0);
 					QTransform m;
 					m.translate(br.width() / 2.0, br.height() / 2.0);
 					m.rotate(r + 90);
 					m.translate(-br.width() / 2.0, -br.height() / 2.0);
 					m.scale(EndArrowWidth / br.width(), EndArrowWidth / br.width());
 					EndArrow.map(m);
+					refP = m.map(refP);
 					QPainterPath pa2 = EndArrow.toQPainterPath(true);
 					QRectF br2 = pa2.boundingRect();
 					QTransform m2;
 					FPoint grOffset2(getMinClipF(&EndArrow));
 					m2.translate(-grOffset2.x(), -grOffset2.y());
-					m2.translate(-br2.width() / 2.0, -br2.height() / 2.0);
 					EndArrow.map(m2);
+					refP = m2.map(refP);
+					EndArrow.translate(-refP.x(), -refP.y());
 					QTransform arrowTrans;
 					arrowTrans.translate(-m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
 					arrowTrans.translate(End.x() + ite->xPos(), End.y() + ite->yPos());
@@ -1375,19 +1378,22 @@
 				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
 				{
 					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
+					QPointF refP = QPointF(br.width() / 2.0, 0);
 					QTransform m;
 					m.translate(br.width() / 2.0, br.height() / 2.0);
 					m.rotate(r + 90);
 					m.translate(-br.width() / 2.0, -br.height() / 2.0);
 					m.scale(EndArrowWidth / br.width(), EndArrowWidth / br.width());
 					EndArrow.map(m);
+					refP = m.map(refP);
 					QPainterPath pa2 = EndArrow.toQPainterPath(true);
 					QRectF br2 = pa2.boundingRect();
 					QTransform m2;
 					FPoint grOffset2(getMinClipF(&EndArrow));
 					m2.translate(-grOffset2.x(), -grOffset2.y());
-					m2.translate(-br2.width() / 2.0, -br2.height() / 2.0);
 					EndArrow.map(m2);
+					refP = m2.map(refP);
+					EndArrow.translate(-refP.x(), -refP.y());
 					QTransform arrowTrans;
 					arrowTrans.translate(-m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
 					arrowTrans.translate(Start.x() + ite->xPos(), Start.y() + ite->yPos());




More information about the scribus-commit mailing list