r17839 by jghali - #11070: Snap to Items indicator misplaced when document has bleed area

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 28 23:13:48 UTC 2012


Author: jghali
Date: Sun Oct 28 23:13:48 2012
New Revision: 17839

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17839
Log:
#11070: Snap to Items indicator misplaced when document has bleed area

Modified:
    trunk/Scribus/scribus/canvasgesture_resize.cpp
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/canvasmode_create.cpp
    trunk/Scribus/scribus/canvasmode_normal.cpp

Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17839&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Sun Oct 28 23:13:48 2012
@@ -432,9 +432,9 @@
 		m_doc->ApplyGuides(&x, &y);
 		m_doc->ApplyGuides(&x, &y,true);
 		if(x != snappedPoint.x() && m_handle != Canvas::NORTH && m_handle != Canvas::SOUTH)
-			xSnap = x * m_canvas->scale();
+			xSnap = x;
 		if(y != snappedPoint.y() && m_handle != Canvas::EAST && m_handle != Canvas::WEST)
-			ySnap = y * m_canvas->scale();
+			ySnap = y;
 //		if (m_doc->ApplyGuides(&x, &y))
 //			qDebug() << "guides applied:" << snappedPoint.x() << snappedPoint.y() << "to" << x << y;
 		if (m_handle == Canvas::NORTH || m_handle == Canvas::SOUTH) 

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17839&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sun Oct 28 23:13:48 2012
@@ -768,22 +768,25 @@
 
 void CanvasMode::drawSnapLine(QPainter* p)
 {
-	if(m_doc->SnapElement)
-	{
-		if(ySnap)
+	if (m_doc->SnapElement)
+	{
+		MarginStruct bleedValues = m_doc->bleedsVal();
+		QPointF pageOffset = QPointF(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
+		QPoint  pageOrigin = m_canvas->canvasToLocal(pageOffset);
+		if (ySnap)
 		{
 			p->setPen(Qt::green);
-			double x = (m_doc->currentPage()->xOffset() - m_doc->bleedsVal().Left)* m_canvas->scale();
-			double w = (m_doc->currentPage()->width() + m_doc->bleedsVal().Left + m_doc->bleedsVal().Right) * m_canvas->scale();
-			p->drawLine(x, ySnap, x+w,ySnap);
+			QPoint pt = m_canvas->canvasToLocal(QPointF(pageOffset.x(), ySnap));
+			double w  = (m_doc->currentPage()->width() + bleedValues.Left + bleedValues.Right) * m_canvas->scale();
+			p->drawLine(pageOrigin.x(), pt.y(), pageOrigin.x() + w, pt.y());
 			ySnap = 0;
 		}
-		if(xSnap)
+		if (xSnap)
 		{
 			p->setPen(Qt::green);
-			double y = (m_doc->currentPage()->yOffset() - m_doc->bleedsVal().Top) * m_canvas->scale();
-			double h = (m_doc->currentPage()->height() + m_doc->bleedsVal().Bottom + m_doc->bleedsVal().Top) * m_canvas->scale();
-			p->drawLine(xSnap, y, xSnap,y+h);
+			QPoint pt = m_canvas->canvasToLocal(QPointF(xSnap, pageOffset.y()));
+			double h  = (m_doc->currentPage()->height() + bleedValues.Bottom + bleedValues.Top) * m_canvas->scale();
+			p->drawLine(pt.x(), pageOrigin.y(), pt.x(), pageOrigin.y() + h);
 			xSnap = 0;
 		}
 	}

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17839&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Sun Oct 28 23:13:48 2012
@@ -301,9 +301,9 @@
 				m_doc->ApplyGuides(&nx, &ny);
 				m_doc->ApplyGuides(&nx, &ny,true);
 				if(nx!=np2.x())
-					xSnap = nx * m_canvas->scale();
+					xSnap = nx;
 				if(ny!=np2.y())
-					ySnap = ny * m_canvas->scale();
+					ySnap = ny;
 				// #8959 : suppress qRound here as this prevent drawing line with angle constrain
 				// precisely and does not allow to stick precisely to grid or guides
 				newX = /*qRound(*/nx/*)*/;

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17839&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sun Oct 28 23:13:48 2012
@@ -517,9 +517,9 @@
 								m_doc->ApplyGuides(&nx, &ny,true);
 								m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
 								if(ny != nyo)
-									ySnap = ny * m_canvas->scale();
+									ySnap = ny;
 								if(nx != nxo)
-									xSnap = nx * m_canvas->scale();
+									xSnap = nx;
 							}
 						}
 						if (m_doc->useRaster)
@@ -603,9 +603,9 @@
 							m_doc->ApplyGuides(&nx, &ny,true);
 							m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
 							if(ny != nyo)
-								ySnap = ny * m_canvas->scale();
+								ySnap = ny;
 							if(nx != nxo)
-								xSnap = nx * m_canvas->scale();
+								xSnap = nx;
 						}
 					}
 					if (m_doc->useRaster)




More information about the scribus-commit mailing list