r23256 by jghali - #3612: Changing width or height of rotated items behaves inconsistently depending on basepoint

scribus-commit scribus-commit at lists.scribus.net
Tue Oct 15 23:58:03 UTC 2019


Author: jghali
Date: Tue Oct 15 23:58:03 2019
New Revision: 23256

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23256
Log:
#3612: Changing width or height of rotated items behaves inconsistently depending on basepoint

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23256&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Tue Oct 15 23:58:03 2019
@@ -14334,40 +14334,46 @@
 		QString transacDesc = QString(Um::ResizeFromTo).arg(owString, ohString, nwString, nhString);
 		activeTransaction = m_undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize);
 	}
-	int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));
-	QTransform ma;
-	ma.rotate(currItem->rotation());
-	double dX = ma.m11() * (currItem->width() - newW) + ma.m21() * (currItem->height() - newH) + ma.dx();
-	double dY = ma.m22() * (currItem->height() - newH) + ma.m12() * (currItem->width() - newW) + ma.dy();
-//	#8541, #8761: "when resizing with ALT-arrow, the size values in the PP aren't updated"
+	if ((m_rotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal))
+	{
+		QTransform ma;
+		ma.rotate(currItem->rotation());
+		double moveX = ma.m11() * (currItem->width() - newW) + ma.m21() * (currItem->height() - newH) + ma.dx();
+		double moveY = ma.m22() * (currItem->height() - newH) + ma.m12() * (currItem->width() - newW) + ma.dy();
+		if (m_rotMode == 2)
+		{
+			moveX /= 2.0;
+			moveY /= 2.0;
+		}
+		else if (m_rotMode == 1)
+		{
+			moveX = ma.m11() * (currItem->width() - newW);
+			moveY = ma.m12() * (currItem->width() - newW);
+		}
+		else if (m_rotMode == 3)
+		{
+			moveX = ma.m21() * (currItem->height() - newH);
+			moveY = ma.m22() * (currItem->height() - newH);
+		}
+		moveItem(moveX, moveY, currItem);
+	}
+	//	#8541, #8761: "when resizing with ALT-arrow, the size values in the PP aren't updated"
 //	currItem->setWidthHeight(newW, newH, true);
 	currItem->setWidthHeight(newW, newH);
-	if ((m_rotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal))
-	{
-		double moveX=dX, moveY=dY;
-		if (m_rotMode == 2)
-		{
-			moveX /= 2.0;
-			moveY /= 2.0;
-		}
-		else if (m_rotMode == 3)
-			moveX = 0.0;
-		else if (m_rotMode == 1)
-			moveY = 0.0;
-		moveItem(moveX, moveY, currItem);
-	}
+
 	if ((currItem->asImageFrame()) && (!currItem->Sizing) && (appMode != modeEditClip))
 	{
 		currItem->adjustPictScale();
 	}
 	if (currItem->asLine())
 	{
+		int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));
 		if (!fromMP)
 		{
 			FPoint g(currItem->xPos(), currItem->yPos());
 			FPoint t(currItem->width(), 0, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1);
 			t -= g;
-			currItem->setRotation( atan2(t.y(), t.x()) * (180.0/M_PI));
+			currItem->setRotation( atan2(t.y(), t.x()) * (180.0 / M_PI));
 			currItem->setWidthHeight( sqrt(pow(t.x(), 2) + pow(t.y(), 2)), 1.0);
 			//currItem->setXYPos(currItem->xPos(), currItem->yPos());
 		}




More information about the scribus-commit mailing list