r22831 by jghali - #15563: Add shift modifier to resize gesture <Gibbz>

scribus-commit scribus-commit at lists.scribus.net
Sun Feb 3 23:57:45 UTC 2019


Author: jghali
Date: Sun Feb  3 23:57:45 2019
New Revision: 22831

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22831
Log:
#15563: Add shift modifier to resize gesture <Gibbz>

Modified:
    trunk/Scribus/scribus/canvasgesture_resize.cpp

Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22831&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp	Sun Feb  3 23:57:45 2019
@@ -468,8 +468,13 @@
 	QTransform rotation;
 	FPoint docPoint = m_canvas->globalToCanvas(m->globalPos());
 	QPointF oldXY = m_bounds.topLeft();
+
 	// proportional resize
 	bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
+
+	// center resize pivot
+	bool centerPivot = ((m->modifiers() & Qt::ShiftModifier) != Qt::NoModifier);
+
 /*
 	if (m_mousePressPoint == m->globalPos())
 	{
@@ -628,6 +633,41 @@
 //		qDebug() << "constrained:" << m_bounds << double(m_bounds.width()) / m_bounds.height();
 	}
 
+	// shif key modifier
+	// move around around the pivot
+	if (centerPivot)
+		m_bounds.moveCenter(m_origBounds.center());
+	else 
+	{
+		// reset to original position if user releases shift button during resize
+		switch (m_handle)
+		{
+			case Canvas::NORTHWEST:
+				m_bounds.moveBottomRight(m_origBounds.bottomRight());
+				break;
+			case Canvas::WEST:
+				m_bounds.moveRight(m_origBounds.right());
+				break;
+			case Canvas::SOUTHWEST:
+				m_bounds.moveTopRight(m_origBounds.topRight());
+				break;
+			case Canvas::SOUTH:
+				m_bounds.moveTop(m_origBounds.top());
+				break;
+			case Canvas::NORTHEAST:
+				m_bounds.moveBottomLeft(m_origBounds.bottomLeft());
+				break;
+			case Canvas::EAST:
+				m_bounds.moveLeft(m_origBounds.left());
+				break;
+			case Canvas::SOUTHEAST:
+				m_bounds.moveTopLeft(m_origBounds.topLeft());
+				break;
+			default:
+				break;
+		}
+	}
+
 	// re-rotate: if top left has changed, then it needs rotation
 	if (m_rotation != 0 && oldXY != m_bounds.topLeft())
 	{




More information about the scribus-commit mailing list