View Issue Details

IDProjectCategoryView StatusLast Update
0015976ScribusGeneralpublic2019-12-09 10:00
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.5.6.svn 
Target VersionFixed in Version 
Summary0015976: [PATCH] slightly simplify the cursor setting in canvasmode_*.cpp
Descriptionwhile working on 0015869 i'm trying to find out how setting the cursor works and i stumbled upon this:

does this loop do anything?

https://gitlab.com/scribus/scribus/blob/master/scribus/canvasmode_drawcalligraphic.cpp#L151

            for (int i = 0; i < m_doc->m_Selection->count(); ++i)
            {
                currItem = m_doc->m_Selection->itemAt(i);
                if (currItem->locked())
                    break;
                setModeCursor();
            }

except setting the same cursor n times?

why does it break on the first locked item?

does the attached patch change anything?
TagsNo tags attached.
PatchYes

Activities

ale

2019-11-30 19:46

manager  

cursor-mode-calligraphic-loop.diff (569 bytes)
diff --git a/scribus/canvasmode_drawcalligraphic.cpp b/scribus/canvasmode_drawcalligraphic.cpp
index 4821b8d00..0249250ac 100644
--- a/scribus/canvasmode_drawcalligraphic.cpp
+++ b/scribus/canvasmode_drawcalligraphic.cpp
@@ -148,13 +148,7 @@ void CalligraphicMode::mouseMoveEvent(QMouseEvent *m)
 				setModeCursor();
 				return;
 			}
-			for (int i = 0; i < m_doc->m_Selection->count(); ++i)
-			{
-				currItem = m_doc->m_Selection->itemAt(i);
-				if (currItem->locked())
-					break;
-				setModeCursor();
-			}
+			setModeCursor();
 		}
 	}
 	else

ale

2019-11-30 19:55

manager   ~0047175

this loop can be found in several canvasmode_*.cpp files and i really wonder why it contains a break and not a continue when a locked item is found in the selection...

jghali

2019-11-30 20:08

administrator   ~0047177

The "m_doc->m_Selection->isMultipleSelection() block" located above this loop guarantee that this loop is executed only if n=0 or n=1. It is a trick to handle both cases while reducing the number of if blocks. Given the possible value of n when this code is executed, the "break" instruction is totally appropriate.

ale

2019-12-01 11:10

manager   ~0047179

yes, but what is this loop doing?

it calls n time setModeCursor(), which only depends on appMode, without changing the appMode...
and if one of the items is locked it stops doing that.

why?

wait... what?

        PageItem *itemAt(int index=0) { return itemAt_(index); }
        const PageItem *itemAt(int index=0) const { return const_cast<Selection*>(this)->itemAt_(index); }

how does it work?

two functions with the same signature, only difference is the constness of the return value.
the second function is marked as const but it is not const!

and itemAt() does not just return the item but also deletes it from the list? the name is imo very misleading...

i'm more and more puzzled about what this part of code is doing...

can somebody explain it?
please...

ale

2019-12-01 13:36

manager   ~0047180

Last edited: 2019-12-01 14:44

View 2 revisions

ok, got a chat with jean in irc...

so first, does this

    if (GetItem(&currItem))
        {
               [....]
            if (!(m_doc->m_Selection->count() == 1 && currItem->locked()))
                setModeCursor();
     }

do the same as:

            if (m_doc->m_Selection->isMultipleSelection())
            {
                setModeCursor();
                return;
            }
            for (int i = 0; i < m_doc->m_Selection->count(); ++i)
            {
                currItem = m_doc->m_Selection->itemAt(i);
                if (currItem->locked())
                    break;
                setModeCursor();
            }

?

the rationals:

- "if (GetItem(&currItem))" already ensures that at least one item is selected
- "GetItem(&currItem)" already puts selection.at(0) into currItem
- so we update the cursor except when only one item is selected and it's locked
  "(count() > 1 || item->locked())" looks nicer to me, "(!(n == 1 && item->locked()))" is imo more semantycally...

then: jean explained that itemAt() only removes null items (since the items are pointers that might be otherwise be deleted, that's useful and not dangerous...
i really think that a comment is needed.
oh, there is a comment, but imo at the wrong place.
in PageItem *Selection::itemAt_(int index), the commented out line should be removed and the other comment should be converted into a "javadoc"

\brief return the item if it's not a nullptr. remove the item and return nullptr, if the item we point to has been deleted by other parts of the code.

ale

2019-12-09 09:59

manager   ~0047226

in the effort to simplify the cursor changes and slowly get to a streamlined path where we can avoid the flickering, i'm proposing a patch that:

- removes the whole "if (getCurrItem) ... else ..." for the files that have the same code has the calligraphic tool:
  - the first part (discussed above) does not make a visible difference
  - the second part is never activated (or at least i could not activate it)
- in CanvasMode_Edit::mouseMoveEvent(), use the pageItem from the top level if (in edit mode, a multiple selection does not really make sense and removing the check does not make a visible difference)
- i did not modify CanvasMode_Rotate::mouseMoveEvent() since:
  - it's rather (uselessly?) complex but fails at setting the new cursor (0015999)
- i also removed dead code (out commented or "if falsed") that did not have any comment on the reason why it has been left there and did look harmless to remove

canvasmode-cursor-use-pageitem.diff (16,986 bytes)
diff --git a/scribus/canvasmode_create.cpp b/scribus/canvasmode_create.cpp
index 5a861b024..dd76c9327 100644
--- a/scribus/canvasmode_create.cpp
+++ b/scribus/canvasmode_create.cpp
@@ -246,11 +246,7 @@ void CreateMode::mouseMoveEvent(QMouseEvent *m)
 	double newX, newY;
 	PageItem *currItem;
 	QPainter p;
-//	QRect tx;
 	m->accept();
-//	qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
-//	emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(), 
-//				  m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
 
 	if (commonMouseMove(m))
 		return;
diff --git a/scribus/canvasmode_drawbezier.cpp b/scribus/canvasmode_drawbezier.cpp
index 44bef0be4..7ed75609a 100644
--- a/scribus/canvasmode_drawbezier.cpp
+++ b/scribus/canvasmode_drawbezier.cpp
@@ -237,12 +237,8 @@ void BezierMode::mouseMoveEvent(QMouseEvent *m)
 	double newX, newY;
 	PageItem *currItem;
 	FPoint npf, npf2;
-//	QRect tx;
 	m->accept();
 	m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y());
-//	qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
-//	emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(), 
-//				  m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
 	if (commonMouseMove(m))
 		return;
 	
diff --git a/scribus/canvasmode_drawcalligraphic.cpp b/scribus/canvasmode_drawcalligraphic.cpp
index 8c3185cf0..2c2fd1b95 100644
--- a/scribus/canvasmode_drawcalligraphic.cpp
+++ b/scribus/canvasmode_drawcalligraphic.cpp
@@ -99,9 +99,7 @@ void CalligraphicMode::mouseMoveEvent(QMouseEvent *m)
 {
 	const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
 	
-	PageItem *currItem;
 	FPoint npf, npf2;
-//	QRect tx;
 	m->accept();
 	m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y());
 
@@ -135,39 +133,6 @@ void CalligraphicMode::mouseMoveEvent(QMouseEvent *m)
 		m_view->updateCanvas(bRect);
 		return;
 	}
-	
-	if (GetItem(&currItem))
-	{
-		if (m_doc->DragP)
-			return;
-				
-		if ((!m_mouseButtonPressed) && (m_doc->appMode != modeDrawBezierLine))
-		{
-			if (m_doc->m_Selection->isMultipleSelection())
-			{
-				setModeCursor();
-				return;
-			}
-			for (int i = 0; i < m_doc->m_Selection->count(); ++i)
-			{
-				currItem = m_doc->m_Selection->itemAt(i);
-				if (currItem->locked())
-					break;
-				setModeCursor();
-			}
-		}
-	}
-	else
-	{
-		if ((m_mouseButtonPressed) && (m->buttons() & Qt::LeftButton))
-		{
-			QPoint startP = m_canvas->canvasToGlobal(QPointF(m_xp, m_yp));
-			m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
-			m_view->setRedrawMarkerShown(true);
-			m_view->HaveSelRect = true;
-			return;
-		}
-	}
 }
 
 void CalligraphicMode::mousePressEvent(QMouseEvent *m)
diff --git a/scribus/canvasmode_drawfreehand.cpp b/scribus/canvasmode_drawfreehand.cpp
index 73b9279da..6acff85c2 100644
--- a/scribus/canvasmode_drawfreehand.cpp
+++ b/scribus/canvasmode_drawfreehand.cpp
@@ -94,9 +94,7 @@ void FreehandMode::mouseDoubleClickEvent(QMouseEvent *m)
 void FreehandMode::mouseMoveEvent(QMouseEvent *m)
 {
 	const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
-	PageItem *currItem;
 	FPoint npf, npf2;
-//	QRect tx;
 	m->accept();
 	m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y());
 	if (commonMouseMove(m))
@@ -122,38 +120,6 @@ void FreehandMode::mouseMoveEvent(QMouseEvent *m)
 		m_view->updateCanvas(bRect);
 		return;
 	}
-	if (GetItem(&currItem))
-	{
-		if (m_doc->DragP)
-			return;
-				
-		if ((!m_mouseButtonPressed) && (m_doc->appMode != modeDrawBezierLine))
-		{
-			if (m_doc->m_Selection->isMultipleSelection())
-			{
-				setModeCursor();
-				return;
-			}
-			for (int a = 0; a < m_doc->m_Selection->count(); ++a)
-			{
-				currItem = m_doc->m_Selection->itemAt(a);
-				if (currItem->locked())
-					break;
-				setModeCursor();
-			}
-		}
-	}
-	else
-	{
-		if ((m_mouseButtonPressed) && (m->buttons() & Qt::LeftButton))
-		{
-			QPoint startP = m_canvas->canvasToGlobal(QPointF(m_xp, m_yp));
-			m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
-			m_view->setRedrawMarkerShown(true);
-			m_view->HaveSelRect = true;
-			return;
-		}
-	}
 }
 
 void FreehandMode::mousePressEvent(QMouseEvent *m)
diff --git a/scribus/canvasmode_edit.cpp b/scribus/canvasmode_edit.cpp
index 6af009001..87c008a1c 100644
--- a/scribus/canvasmode_edit.cpp
+++ b/scribus/canvasmode_edit.cpp
@@ -471,40 +471,26 @@ void CanvasMode_Edit::mouseMoveEvent(QMouseEvent *m)
 				}
 			}
 		}
-		if (!m_canvas->m_viewMode.m_MouseButtonPressed)
+		if (!m_canvas->m_viewMode.m_MouseButtonPressed && !currItem->locked())
 		{
-			if (m_doc->m_Selection->isMultipleSelection())
-			{
-				setModeCursor();
-				return;
-			}
-			for (int a = 0; a < m_doc->m_Selection->count(); ++a)
+			int hitTest = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
+			if (hitTest >= 0)
 			{
-				currItem = m_doc->m_Selection->itemAt(a);
-				if (currItem->locked())
-					break;
-				int hitTest = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
-				if (hitTest >= 0)
+				if (hitTest == Canvas::INSIDE)
 				{
-					if (hitTest == Canvas::INSIDE)
+					if (currItem->asTextFrame())
+						m_view->setCursor(QCursor(Qt::IBeamCursor));
+					if (currItem->asImageFrame())
 					{
-						if (currItem->asTextFrame())
-							m_view->setCursor(QCursor(Qt::IBeamCursor));
-						if (currItem->asImageFrame())
-						{
-							if (m->modifiers() & Qt::ShiftModifier)
-								m_view->setCursor(IconManager::instance().loadCursor("Rotieren2.png"));
-							else
-								m_view->setCursor(IconManager::instance().loadCursor("handc.png"));
-						}
+						if (m->modifiers() & Qt::ShiftModifier)
+							m_view->setCursor(IconManager::instance().loadCursor("Rotieren2.png"));
+						else
+							m_view->setCursor(IconManager::instance().loadCursor("handc.png"));
 					}
 				}
-				else
-				{
-// 					setModeCursor();
-					m_view->setCursor(QCursor(Qt::ArrowCursor));
-				}
 			}
+			else
+				m_view->setCursor(QCursor(Qt::ArrowCursor));
 		}
 	}
 	else
diff --git a/scribus/canvasmode_editgradient.cpp b/scribus/canvasmode_editgradient.cpp
index b947cf862..23f5d999c 100644
--- a/scribus/canvasmode_editgradient.cpp
+++ b/scribus/canvasmode_editgradient.cpp
@@ -635,68 +635,8 @@ void CanvasMode_EditGradient::mouseMoveEvent(QMouseEvent *m)
 		}
 		m_Mxp = newX;
 		m_Myp = newY;
-//		m_view->RefreshGradient(currItem, dx * m_canvas->scale(), dy * m_canvas->scale());
 		m_ScMW->propertiesPalette->updateColorSpecialGradient();
 		currItem->update();
-/*		QRectF upRect;
-		if (m_view->editStrokeGradient == 1)
-		{
-			upRect = QRectF(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY));
-			double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
-			double rotEnd = xy2Deg(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
-			QTransform m;
-			m.translate(currItem->GrStrokeStartX, currItem->GrStrokeStartY);
-			m.rotate(rotEnd);
-			m.rotate(-90);
-			m.rotate(currItem->GrStrokeSkew);
-			m.translate(radEnd * currItem->GrStrokeScale, 0);
-			QPointF shP = m.map(QPointF(0,0));
-			upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY)).normalized());
-			upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY)).normalized());
-			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-			upRect |= QRectF(shP, QPointF(currItem->width(), currItem->height())).normalized();
-		}
-		else if (m_view->editStrokeGradient == 2)
-		{
-			upRect = QRectF(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY));
-			double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
-			double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
-			QTransform m;
-			m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY);
-			m.rotate(rotEnd);
-			m.rotate(-90);
-			m.rotate(currItem->GrMaskSkew);
-			m.translate(radEnd * currItem->GrMaskScale, 0);
-			QPointF shP = m.map(QPointF(0,0));
-			upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY)).normalized());
-			upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY)).normalized());
-			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-			upRect |= QRectF(shP, QPointF(currItem->width(), currItem->height())).normalized();
-		}
-		else if (m_view->editStrokeGradient == 0)
-		{
-			upRect = QRectF(QPointF(currItem->GrStartX, currItem->GrStartY), QPointF(currItem->GrEndX, currItem->GrEndY));
-			double radEnd = distance(currItem->GrEndX - currItem->GrStartX, currItem->GrEndY - currItem->GrStartY);
-			double rotEnd = xy2Deg(currItem->GrEndX - currItem->GrStartX, currItem->GrEndY - currItem->GrStartY);
-			QTransform m;
-			m.translate(currItem->GrStartX, currItem->GrStartY);
-			m.rotate(rotEnd);
-			m.rotate(-90);
-			m.rotate(currItem->GrSkew);
-			m.translate(radEnd * currItem->GrScale, 0);
-			QPointF shP = m.map(QPointF(0,0));
-			upRect |= QRectF(shP, QPointF(currItem->GrEndX, currItem->GrEndY)).normalized();
-			upRect |= QRectF(shP, QPointF(currItem->GrStartX, currItem->GrStartY)).normalized();
-			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-			upRect |= QRectF(shP, QPointF(currItem->width(), currItem->height())).normalized();
-		}
-		else if ((m_view->editStrokeGradient == 3) || (m_view->editStrokeGradient == 4))
-		{
-			upRect = QRectF(QPointF(-currItem->width(), -currItem->height()), QPointF(currItem->width() * 2, currItem->height() * 2)).normalized();
-		}
-		QTransform itemMatrix = currItem->getTransform();
-		upRect = itemMatrix.mapRect(upRect);
-		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); */
 		if (currItem->GrType == 13)
 			currItem->createConicalMesh();
 		m_doc->regionsChanged()->update(QRectF());
diff --git a/scribus/canvasmode_eyedropper.cpp b/scribus/canvasmode_eyedropper.cpp
index 2e8f6894b..70fa374f2 100644
--- a/scribus/canvasmode_eyedropper.cpp
+++ b/scribus/canvasmode_eyedropper.cpp
@@ -114,9 +114,6 @@ void CanvasMode_EyeDropper::mouseDoubleClickEvent(QMouseEvent *m)
 
 void CanvasMode_EyeDropper::mouseMoveEvent(QMouseEvent *m)
 {
-	/*m->accept();
-	if (commonMouseMove(m))
-		return;*/
 	m->accept();
 }
 
diff --git a/scribus/canvasmode_framelinks.cpp b/scribus/canvasmode_framelinks.cpp
index 085d86975..ac81d51c3 100644
--- a/scribus/canvasmode_framelinks.cpp
+++ b/scribus/canvasmode_framelinks.cpp
@@ -139,8 +139,6 @@ void CanvasMode_FrameLinks::mouseDoubleClickEvent(QMouseEvent *m)
 
 void CanvasMode_FrameLinks::mouseMoveEvent(QMouseEvent *m)
 {
-	//const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
-	
 	m->accept();
 
 	if (commonMouseMove(m))
diff --git a/scribus/canvasmode_normal.cpp b/scribus/canvasmode_normal.cpp
index 1680fe728..41cec4b94 100644
--- a/scribus/canvasmode_normal.cpp
+++ b/scribus/canvasmode_normal.cpp
@@ -301,13 +301,10 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 	PageItem *currItem=nullptr;
 	bool erf = false;
 	m->accept();
-//	qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
-//	emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(), 
-//				  m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
 
 	if (commonMouseMove(m))
 		return;
-//	m_mouseCurrentPoint = mousePointDoc;
+
 	bool movingOrResizing = (m_canvas->m_viewMode.operItemMoving || m_canvas->m_viewMode.operItemResizing);
 	bool mouseIsOnPage    = (m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y()) != -1);
 	if ((m_doc->guidesPrefs().guidesShown) && (!m_doc->GuideLock) && (!movingOrResizing) && (mouseIsOnPage) )
@@ -481,9 +478,6 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 				dr->setMimeData(md);
 				const QPixmap& pm = IconManager::instance().loadPixmap("dragpix.png");
 				dr->setPixmap(pm);
-			//	dr->setDragCursor(pm, Qt::CopyAction);
-			//	dr->setDragCursor(pm, Qt::MoveAction);
-			//	dr->setDragCursor(pm, Qt::LinkAction);
 				dr->exec();
 				m_doc->DragP = false;
 				m_doc->leaveDrag = false;
@@ -541,7 +535,6 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 						}
 						double gx, gy, gh, gw;
 						m_objectDeltaPos.setXY(dX, dY);
-					//	m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 						m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
 						// #10677 : temporary hack : we need to introduce the
 						// concept of item snapping points to handle better
@@ -566,13 +559,6 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 							ny = nyo = gy + gh + m_objectDeltaPos.y();
 							m_doc->ApplyGuides(&nx, &ny);
 							m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-							if (false)
-							{
-								nx = nxo = gx + gw / 2 + m_objectDeltaPos.x();
-								ny = nyo = gy + gh / 2 + m_objectDeltaPos.y();
-								m_doc->ApplyGuides(&nx, &ny);
-								m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-							}
 						}
 						if (m_doc->SnapElement)
 						{
@@ -619,7 +605,6 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 				{
 					double gx, gy, gh, gw;
 					m_doc->m_Selection->setGroupRect();
-				//	m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 					m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
 					int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
 					erf = true;
@@ -645,13 +630,6 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 						ny = nyo = gy + gh + m_objectDeltaPos.y();
 						m_doc->ApplyGuides(&nx, &ny);
 						m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
-						if (false)
-						{
-							nx = nxo = gx + gw/2 + m_objectDeltaPos.x();
-							ny = nyo = gy + gh/2 + m_objectDeltaPos.y();
-							m_doc->ApplyGuides(&nx, &ny);
-							m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
-						}
 					}
 					if (m_doc->SnapElement)
 					{
@@ -728,12 +706,9 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 		{
 			if (m_doc->m_Selection->isMultipleSelection())
 			{
-//				QRect mpo = QRect(qRound(m->x()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, qRound(m->y()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, m_doc->guidesPrefs().grabRad*2, m_doc->guidesPrefs().grabRad*2);
-//				mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x()), qRound(m_doc->minCanvasCoordinate.y()));
 				double gx, gy, gh, gw;
 				m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
 				int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
-//				if ((QRect(static_cast<int>(gx), static_cast<int>(gy), static_cast<int>(gw), static_cast<int>(gh)).intersects(mpo))
 				if (how >= 0)
 				{
 					if (how > 0)
@@ -759,7 +734,7 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 				QTransform p;
 				m_canvas->Transform(currItem, p);
 				QRect mpo = QRect(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
-//				mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
+
 				if ((QRegion(p.map(QPolygon(QRect(-3, -3, static_cast<int>(currItem->width()+6), static_cast<int>(currItem->height()+6))))).contains(mpo)))
 				{
 					QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
diff --git a/scribus/canvasmode_objimport.cpp b/scribus/canvasmode_objimport.cpp
index 1ba055adb..de05f2dc8 100644
--- a/scribus/canvasmode_objimport.cpp
+++ b/scribus/canvasmode_objimport.cpp
@@ -125,8 +125,7 @@ void CanvasMode_ObjImport::mouseMoveEvent(QMouseEvent *m)
 {
 	m->accept();
 
-	if (commonMouseMove(m))
-		return;
+	commonMouseMove(m);
 }
 
 void CanvasMode_ObjImport::mousePressEvent(QMouseEvent *m)

Issue History

Date Modified Username Field Change
2019-11-30 19:46 ale New Issue
2019-11-30 19:46 ale File Added: cursor-mode-calligraphic-loop.diff
2019-11-30 19:47 ale Description Updated View Revisions
2019-11-30 19:55 ale Note Added: 0047175
2019-11-30 20:08 jghali Note Added: 0047177
2019-12-01 11:10 ale Note Added: 0047179
2019-12-01 13:36 ale Note Added: 0047180
2019-12-01 14:44 ale Note Edited: 0047180 View Revisions
2019-12-09 09:59 ale File Added: canvasmode-cursor-use-pageitem.diff
2019-12-09 09:59 ale Note Added: 0047226
2019-12-09 10:00 ale Summary Cursor: what does this loop do? => [PATCH] slightly simplify the cursor setting in canvasmode_*.cpp
2019-12-09 10:00 ale Patch No => Yes