r16314 by fschmid - Use correct angle transformations in the "Edit Spiral" dialog.

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 29 10:16:23 CET 2011


Author: fschmid
Date: Sat Jan 29 09:16:23 2011
New Revision: 16314

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16314
Log:
Use correct angle transformations in the "Edit Spiral" dialog.

Modified:
    trunk/Scribus/scribus/canvasmode_editspiral.cpp
    trunk/Scribus/scribus/canvasmode_editspiral.h

Modified: trunk/Scribus/scribus/canvasmode_editspiral.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16314&path=/trunk/Scribus/scribus/canvasmode_editspiral.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editspiral.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editspiral.cpp Sat Jan 29 09:16:23 2011
@@ -126,7 +126,7 @@
 	endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 2);
 	startAngle = item->spiralStartAngle;
 	endAngle = item->spiralEndAngle;
-	VectorDialog->setValues(startAngle, endAngle, item->spiralFactor);
+	VectorDialog->setValues(computeRealAngle(startAngle, false), computeRealAngle(endAngle, false), item->spiralFactor);
 	VectorDialog->show();
 	setModeCursor();
 	if (fromGesture)
@@ -148,7 +148,7 @@
 	endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 2);
 	startAngle = item->spiralStartAngle;
 	endAngle = item->spiralEndAngle;
-	VectorDialog->setValues(startAngle, endAngle, item->spiralFactor);
+	VectorDialog->setValues(computeRealAngle(startAngle, false), computeRealAngle(endAngle, false), item->spiralFactor);
 	m_view->update();
 }
 
@@ -198,7 +198,7 @@
 	return ret;
 }
 
-double CanvasMode_EditSpiral::computeRealAngle(double angle)
+double CanvasMode_EditSpiral::computeRealAngle(double angle, bool fromDia)
 {
 	PageItem *currItem = m_doc->m_Selection->itemAt(0);
 	double ret = angle;
@@ -208,8 +208,17 @@
 	bb.scale(currItem->width() / currItem->height(), 1.0);
 	QLineF inp = QLineF(QPointF(currItem->width() / 2.0, currItem->height() / 2.0), QPointF(currItem->width(), currItem->height() / 2.0));
 	inp.setAngle(part);
-	QLineF res = bb.map(inp);
-	ret = res.angle();
+	if (fromDia)
+	{
+		QLineF res = bb.map(inp);
+		ret = res.angle();
+	}
+	else
+	{
+		QTransform bt = bb.inverted();
+		QLineF res = bt.map(inp);
+		ret = res.angle();
+	}
 	ret += rev * 360;
 	return ret;
 }
@@ -221,8 +230,8 @@
 	QPointF mPoint = item->PoLine.pointQF(0);
 	QRectF upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
 	upRect.translate(currItem->xPos(), currItem->yPos());
-	item->spiralStartAngle = computeRealAngle(start);
-	item->spiralEndAngle = computeRealAngle(end);
+	item->spiralStartAngle = computeRealAngle(start, true);
+	item->spiralEndAngle = computeRealAngle(end, true);
 	item->spiralFactor = factor;
 	item->recalcPath();
 	startPoint = currItem->PoLine.pointQF(0);
@@ -292,7 +301,7 @@
 				startPoint = currItem->PoLine.pointQF(0);
 				m_canvas->displayRealRotHUD(m->globalPos(), startAngle);
 			}
-			VectorDialog->setValues(startAngle, endAngle, item->spiralFactor);
+			VectorDialog->setValues(computeRealAngle(startAngle, false), computeRealAngle(endAngle, false), item->spiralFactor);
 		}
 		else if (m_arcPoint == useControlEnd)
 		{
@@ -304,7 +313,7 @@
 				endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 2);
 				m_canvas->displayRealRotHUD(m->globalPos(), endAngle);
 			}
-			VectorDialog->setValues(startAngle, endAngle, item->spiralFactor);
+			VectorDialog->setValues(computeRealAngle(startAngle, false), computeRealAngle(endAngle, false), item->spiralFactor);
 		}
 		currItem->update();
 		QRectF upRect;

Modified: trunk/Scribus/scribus/canvasmode_editspiral.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16314&path=/trunk/Scribus/scribus/canvasmode_editspiral.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editspiral.h (original)
+++ trunk/Scribus/scribus/canvasmode_editspiral.h Sat Jan 29 09:16:23 2011
@@ -66,7 +66,7 @@
 
 	inline bool GetItem(PageItem** pi);
 	QPointF getSegment(double angle);
-	double computeRealAngle(double angle);
+	double computeRealAngle(double angle, bool fromDia);
 
 	double Mxp, Myp;
 	ScribusMainWindow* m_ScMW;




More information about the scribus-commit mailing list