View Issue Details

IDProjectCategoryView StatusLast Update
0017144ScribusGraphics / Image Framespublic2024-01-27 10:10
Reporterale Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.7.0.svn 
Summary0017144: PATCH: ctrl: move image orthogonally inside of the image frame
Descriptioni still dream of 0015560 , but in the meantime we could have ctrl to force an orthogonal move inside of an image frame...
Tagspatch
PatchYes

Activities

ale

2024-01-27 09:15

manager  

image-move-orthogonal.diff (1,868 bytes)   
diff --git a/scribus/canvasmode_edit.cpp b/scribus/canvasmode_edit.cpp
index 0bba8be85..04a89ecad 100644
--- a/scribus/canvasmode_edit.cpp
+++ b/scribus/canvasmode_edit.cpp
@@ -445,6 +445,17 @@ void CanvasMode_Edit::mouseMoveEvent(QMouseEvent *m)
 					m_view->setCursor(IconManager::instance().loadCursor("handc.png"));
 					QTransform mm1 = currItem->getTransform();
 					QTransform mm2 = mm1.inverted();
+					if (m->modifiers() & Qt::ControlModifier)
+					{
+						//Dragging orthogonally - Ctrl Drag
+						int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
+						if (abs(dX) > abs(dY))
+							dY = 0;
+						else if (abs(dY) > abs(dX))
+							dX = 0;
+						newX = m_mousePressPoint.x() + dX;
+						newY = m_mousePressPoint.y() + dY;
+					}
 					QPointF rota = mm2.map(QPointF(newX, newY)) - mm2.map(QPointF(Mxp, Myp));
 					currItem->moveImageInFrame(rota.x() / currItem->imageXScale(), rota.y() / currItem->imageYScale());
 					m_canvas->displayXYHUD(m->globalPosition(), currItem->imageXOffset() * currItem->imageXScale(), currItem->imageYOffset() * currItem->imageYScale());
@@ -567,6 +578,7 @@ void CanvasMode_Edit::mousePressEvent(QMouseEvent *m)
 	m_canvas->m_viewMode.operItemMoving = false;
 	m_view->HaveSelRect = false;
 	m_doc->DragP = false;
+	m_mousePressPoint = mousePointDoc;
 	m_doc->leaveDrag = false;
 	m->accept();
 	m_view->registerMousePress(m->globalPosition());
diff --git a/scribus/canvasmode_edit.h b/scribus/canvasmode_edit.h
index a87677678..1ef6bc5fe 100644
--- a/scribus/canvasmode_edit.h
+++ b/scribus/canvasmode_edit.h
@@ -65,6 +65,8 @@ private:
 	bool SeleItem(QMouseEvent *m);
 	void createContextMenu(PageItem *currItem, double mx, double my);
 
+	FPoint m_mousePressPoint;
+
 	QElapsedTimer m_blinkTime;
 	QTimer* m_blinker;
 	ScribusMainWindow* m_ScMW {nullptr};
image-move-orthogonal.diff (1,868 bytes)   

Issue History

Date Modified Username Field Change
2024-01-27 09:15 ale New Issue
2024-01-27 09:15 ale File Added: image-move-orthogonal.diff
2024-01-27 10:10 ale Tag Attached: patch