View Issue Details

IDProjectCategoryView StatusLast Update
0018000ScribusUser Interfacepublic2026-11-17 07:44
Reporterbuttar Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Target Version1.7.5.svn 
Summary0018000: [patch] Improve object movement, snapping and live drag feedback
DescriptionScribus currently uses an outline-only drag preview rather than live object movement, and its snapping feedback is fragmented across movement paths. This series unifies the movement path and improves direct manipulation without changing document data or file format.

## `omi1-selection-center-marker-v1.02.patch`

- Adds a centre/reference marker for selected objects, groups and multi-selections. Fixed screen size; no document-data changes.

## `omi2-selection-movement-improvements-v1.06.patch`

Improves movement/snapping:
- Unified single/multi-selection snapping.
- Centre snapping to items, guides and page geometry.
- Better rotated-target bounds and sub-point movement.
- Shared preview/final snap delta.
- Improved Create/Resize snap feedback and auto-scroll.
- Magenta snap/alignment feedback lines.

## `omi3-live-object-movement-v1.06.patch`

Adds live object movement instead of outline-only dragging.
- Geometry commits once on release.
- Preserves stacking/clipping/transparency.
- Supports groups, multi-selection and linked-frame feedback.
- Esc cancels and restores the original position.
- Nested Alt-selected group children retain outline fall-back.
Tags#please_test
Attached Files
omi1-selection-center-marker-v1.02.patch (3,370 bytes)   
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 27881)
+++ scribus/canvasmode.cpp	(working copy)
@@ -220,6 +220,16 @@
 	drawSelectionHandle(psx, QPointF(x, y + h / 2.0), p, m_canvas->scale());
 }
 
+constexpr qreal kSelectionCenterMarkerSizePx = 3.0;
+
+static void drawSelectionCenterMarker(QPainter *psx, const QPointF& center, const QPen& pen, qreal scaleFactor)
+{
+	const qreal markerSize = kSelectionCenterMarkerSizePx / scaleFactor;
+	QRectF markerRect(0.0, 0.0, markerSize, markerSize);
+	markerRect.moveCenter(center);
+	psx->fillRect(markerRect, pen.color());
+}
+
 void CanvasMode::drawSelection(QPainter* psx, bool drawHandles)
 {
 	psx->scale(m_canvas->scale(), m_canvas->scale());
@@ -283,7 +293,11 @@
 		psx->setBrush(m_brush["selection-group"]);
 		psx->drawRect(QRectF(x, y, w, h));
 		if (drawHandles)
+		{
 			drawSelectionHandles(psx, QRectF(x, y, w, h));
+			if (m_doc->appMode == modeNormal)
+				drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
+		}
 		psx->restore();
 	}
 	else if (m_doc->m_Selection->isNotEmpty())
@@ -324,7 +338,11 @@
 					psx->setBrush(m_brush["selection-group-inside"]);
 					psx->drawRect(drRect);
 					if (drawHandles)
+					{
 						drawSelectionHandles(psx, QRectF(x, y, w, h), true);
+						if (m_doc->appMode == modeNormal)
+							drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-group-inside"), m_canvas->scale());
+					}
 				}
 			}
 			else
@@ -371,6 +389,8 @@
 					}
 					else
 						drawSelectionHandles(psx, QRectF(x, y, w, h));
+					if (m_doc->appMode == modeNormal)
+						drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
 				}
 				if (currItem->isWelded())
 				{
@@ -427,6 +447,14 @@
 			double visualHeight = currItem->visualHeight();
 			double visualLineWidth = currItem->visualLineWidth();
 			double matRot = getRotationDFromMatrix(itemTrans);
+			QRectF visualRect;
+			if (currItem->isGroup())
+				visualRect = QRectF(0.0, 0.0, visualWidth, visualHeight);
+			else if (currItem->isLine())
+				visualRect = QRectF(0.0, -visualLineWidth / 2.0, visualWidth, visualHeight);
+			else
+				visualRect = QRectF(-visualLineWidth / 2.0, -visualLineWidth / 2.0, visualWidth, visualHeight);
+			const QPointF selectionCenter = itemTrans.map(visualRect.center());
 
 			if (currItem->isGroup())
 			{
@@ -497,6 +525,8 @@
 				p->drawPath(currItem->PoLine.toQPainterPath(false));
 				p->restore();
 			}
+			if (m_doc->appMode == modeNormal)
+				drawSelectionCenterMarker(p, selectionCenter, m_pen.value("selection-handle"), m_canvas->scale());
 		}
 	}
 	else if (m_doc->m_Selection->count() > 1)
@@ -586,11 +616,20 @@
 		}
 		else
 		{
+			p->save();
 			p->setBrush(m_brush["frame-move"]);
 			p->setPen(m_pen["frame-move"]);
 			p->translate(deltax, deltay);
 			p->translate(x, y);
 			p->drawRect(QRectF(0, 0, w, h));
+			p->restore();
+		}
+
+		if (m_doc->appMode == modeNormal)
+		{
+			double vx, vy, vw, vh;
+			m_doc->m_Selection->getVisualGroupRect(&vx, &vy, &vw, &vh);
+			drawSelectionCenterMarker(p, QPointF(vx + vw / 2.0 + deltax, vy + vh / 2.0 + deltay), m_pen.value("selection-handle"), m_canvas->scale());
 		}
 	}
 	p->restore();
omi2-selection-movement-improvements-v1.06.patch (33,531 bytes)   
Index: scribus/canvasgesture_resize.cpp
===================================================================
--- scribus/canvasgesture_resize.cpp	(revision 27881)
+++ scribus/canvasgesture_resize.cpp	(working copy)
@@ -476,8 +476,7 @@
 	}
 */
 	// snap to grid	+ snap to guides
-	xSnap = 0;
-	ySnap = 0;
+	clearSnapFeedback();
 	bool isCorner = m_handle == Canvas::NORTHWEST || m_handle == Canvas::NORTHEAST 
 		|| m_handle == Canvas::SOUTHWEST || m_handle == Canvas::SOUTHEAST;
 	if (m_rotation == 0 || isCorner)
@@ -486,10 +485,13 @@
 		FPoint snappedPoint2 = applyGuides(snappedPoint1);
 
 		double x = snappedPoint2.x(), y = snappedPoint2.y();
+		int snapPage = m_doc->OnPage(x, y);
+		if (snapPage < 0)
+			snapPage = static_cast<int>(m_doc->currentPageNumber());
 		if (x != snappedPoint1.x() && m_handle != Canvas::NORTH && m_handle != Canvas::SOUTH)
-			xSnap = x;
+			setXSnapFeedback(x, snapPage);
 		if (y != snappedPoint1.y() && m_handle != Canvas::EAST && m_handle != Canvas::WEST)
-			ySnap = y;
+			setYSnapFeedback(y, snapPage);
 //		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)
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 27881)
+++ scribus/canvasmode.cpp	(working copy)
@@ -734,39 +734,79 @@
 }
 #endif // GESTURE_FRAME_PREVIEW
 
+void CanvasMode::clearSnapFeedback()
+{
+	clearXSnapFeedback();
+	clearYSnapFeedback();
+}
+
+void CanvasMode::clearXSnapFeedback()
+{
+	xSnap = 0.0;
+	xSnapValid = false;
+	xSnapPage = -1;
+}
+
+void CanvasMode::clearYSnapFeedback()
+{
+	ySnap = 0.0;
+	ySnapValid = false;
+	ySnapPage = -1;
+}
+
+void CanvasMode::setXSnapFeedback(double position, int page)
+{
+	xSnap = position;
+	xSnapValid = (page >= 0);
+	xSnapPage = page;
+}
+
+void CanvasMode::setYSnapFeedback(double position, int page)
+{
+	ySnap = position;
+	ySnapValid = (page >= 0);
+	ySnapPage = page;
+}
+
 void CanvasMode::drawSnapLine(QPainter* p)
 {
-	if (!m_doc->SnapItems)
-		return;
-	if (xSnap == 0.0 && ySnap == 0.0)
+	if (!hasSnapFeedback())
 		return;
-	int page = m_doc->OnPage(m_view->m_mousePointDoc.x(), m_view->m_mousePointDoc.y());
-	if (page == -1)
-		return;
-	MarginStruct bleedValues;
-	ScPage* dragToPage = m_doc->Pages->at(page);
-	if (!dragToPage)
-		return;
-	m_doc->getBleeds(dragToPage, bleedValues);
-	double xOffset = dragToPage->xOffset() - bleedValues.left();
-	double yOffset = dragToPage->yOffset() - bleedValues.top();
-	QPoint pageOrigin = m_canvas->canvasToLocal(QPointF(xOffset, yOffset));
-	if (ySnap)
-	{
-		p->setPen(m_pen["snap-line"]);
-		QPoint pt = m_canvas->canvasToLocal(QPointF(xOffset, ySnap));
-		double w  = (dragToPage->width() + bleedValues.left() + bleedValues.right()) * m_canvas->scale();
-		p->drawLine(pageOrigin.x(), pt.y(), pageOrigin.x() + w, pt.y());
-		ySnap = 0;
-	}
-	if (xSnap)
+
+	auto drawLineOnPage = [&](int page, double position, bool horizontal)
 	{
+		if (page < 0 || page >= m_doc->Pages->count())
+			return;
+
+		ScPage* snapPage = m_doc->Pages->at(page);
+		if (!snapPage)
+			return;
+
+		MarginStruct bleedValues;
+		m_doc->getBleeds(snapPage, bleedValues);
+		const double xOffset = snapPage->xOffset() - bleedValues.left();
+		const double yOffset = snapPage->yOffset() - bleedValues.top();
+		const QPoint pageOrigin = m_canvas->canvasToLocal(QPointF(xOffset, yOffset));
+
 		p->setPen(m_pen["snap-line"]);
-		QPoint pt = m_canvas->canvasToLocal(QPointF(xSnap, yOffset));
-		double h  = (dragToPage->height() + bleedValues.bottom() + bleedValues.top()) * m_canvas->scale();
-		p->drawLine(pt.x(), pageOrigin.y(), pt.x(), pageOrigin.y() + h);
-		xSnap = 0;
-	}
+		if (horizontal)
+		{
+			const QPoint pt = m_canvas->canvasToLocal(QPointF(xOffset, position));
+			const double width = (snapPage->width() + bleedValues.left() + bleedValues.right()) * m_canvas->scale();
+			p->drawLine(pageOrigin.x(), pt.y(), pageOrigin.x() + width, pt.y());
+		}
+		else
+		{
+			const QPoint pt = m_canvas->canvasToLocal(QPointF(position, yOffset));
+			const double height = (snapPage->height() + bleedValues.bottom() + bleedValues.top()) * m_canvas->scale();
+			p->drawLine(pt.x(), pageOrigin.y(), pt.x(), pageOrigin.y() + height);
+		}
+	};
+
+	if (ySnapValid)
+		drawLineOnPage(ySnapPage, ySnap, true);
+	if (xSnapValid)
+		drawLineOnPage(xSnapPage, xSnap, false);
 }
 
 void CanvasMode::setResizeCursor(int how, double rot)
@@ -1773,7 +1813,7 @@
 	m_color["node"]				= QColor(0, 123, 241);
 	m_color["node-handle"]		= QColor(166, 74, 253);
 	m_color["highlight"]		= QColor(220, 58, 140);
-	m_color["snap-line"]		= Qt::green;
+	m_color["snap-line"]		= Qt::magenta;
 	m_color["test"]				= Qt::magenta;
 	QColor selectionAlpha		= m_color.value("frame-selection");
 	selectionAlpha.setAlphaF(.05f);
Index: scribus/canvasmode.h
===================================================================
--- scribus/canvasmode.h	(revision 27881)
+++ scribus/canvasmode.h	(working copy)
@@ -168,6 +168,17 @@
 	bool   m_isActive { false };
 	double xSnap {0.0};
 	double ySnap {0.0};
+	bool xSnapValid {false};
+	bool ySnapValid {false};
+	int xSnapPage {-1};
+	int ySnapPage {-1};
+
+	void clearSnapFeedback();
+	void clearXSnapFeedback();
+	void clearYSnapFeedback();
+	void setXSnapFeedback(double position, int page);
+	void setYSnapFeedback(double position, int page);
+	bool hasSnapFeedback() const { return xSnapValid || ySnapValid; }
 	
 	void setResizeCursor(int how, double rot = 0.0);
 	bool commonMouseMove(QMouseEvent *m);
Index: scribus/canvasmode_create.cpp
===================================================================
--- scribus/canvasmode_create.cpp	(revision 27881)
+++ scribus/canvasmode_create.cpp	(working copy)
@@ -181,6 +181,7 @@
 {
 //	qDebug() << "CreateMode::activate" << fromGesture;
 	CanvasMode::activate(fromGesture);
+	clearSnapFeedback();
 
 	PageItem* currItem;
 	if (!fromGesture || !GetItem(&currItem) || !m_createTransaction)
@@ -284,15 +285,19 @@
 	//CB: #8099: Readd snapping for drag creation of lines by commenting this else..
 	//else
 	//{
+		clearSnapFeedback();
 		FPoint np2 = m_doc->ApplyGridF(FPoint(newX, newY));
 		double nx = np2.x();
 		double ny = np2.y();
 		m_doc->ApplyGuides(&nx, &ny);
 		m_doc->ApplyGuides(&nx, &ny,true);
+		int snapPage = m_doc->OnPage(nx, ny);
+		if (snapPage < 0)
+			snapPage = static_cast<int>(m_doc->currentPageNumber());
 		if (nx != np2.x())
-			xSnap = nx;
+			setXSnapFeedback(nx, snapPage);
 		if (ny != np2.y())
-			ySnap = ny;
+			setYSnapFeedback(ny, snapPage);
 		// #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/*)*/;
@@ -386,6 +391,7 @@
 void CreateMode::mouseReleaseEvent(QMouseEvent *m)
 {
 	modifiers = m->modifiers();
+	clearSnapFeedback();
 
 	PageItem *currItem;
 	m_MouseButtonPressed = false;
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp	(revision 27881)
+++ scribus/canvasmode_normal.cpp	(working copy)
@@ -14,6 +14,9 @@
 ***************************************************************************/
 
 
+#include <array>
+#include <cmath>
+
 #include <QApplication>
 #include <QButtonGroup>
 #include <QCheckBox>
@@ -60,6 +63,38 @@
 #include "ui/pageselector.h"
 #include "undomanager.h"
 
+namespace
+{
+constexpr int kDragAutoScrollMargin = 10;
+constexpr double kDragAutoScrollFactor = 0.75;
+
+struct DragAutoScrollResult
+{
+	int value {0};
+	int residual {0};
+};
+
+DragAutoScrollResult dragAutoScrollValue(QScrollBar* scrollBar, int position, int margin, int viewportExtent)
+{
+	const int current = scrollBar->value();
+	int desired = current;
+	if (position - margin < current)
+		desired = position - margin;
+	else if (position + margin > current + viewportExtent)
+		desired = position + margin - viewportExtent;
+	if (desired == current)
+		return { current, 0 };
+
+	const int target = qBound(scrollBar->minimum(), desired, scrollBar->maximum());
+	const int delta = target - current;
+	int step = qRound(delta * kDragAutoScrollFactor);
+	if (step == 0 && delta != 0)
+		step = (delta > 0) ? 1 : -1;
+	const int value = qBound(scrollBar->minimum(), current + step, scrollBar->maximum());
+	return { value, desired - value };
+}
+}
+
 CanvasMode_Normal::CanvasMode_Normal(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW) 
 {
 }
@@ -70,6 +105,135 @@
 	return (*pi) != nullptr;
 }
 
+void CanvasMode_Normal::updateMovementSnap(const FPoint& rawDelta)
+{
+	m_objectDeltaPos = rawDelta;
+	clearSnapFeedback();
+
+	if (m_doc->m_Selection->isEmpty())
+		return;
+
+	const QRectF visualRect = m_doc->m_Selection->getVisualGroupRect();
+	std::array<double, 3> xAnchors { visualRect.left(), visualRect.center().x(), visualRect.right() };
+	std::array<double, 3> yAnchors { visualRect.top(), visualRect.center().y(), visualRect.bottom() };
+
+	if (m_doc->m_Selection->count() == 1)
+	{
+		PageItem* item = m_doc->m_Selection->itemAt(0);
+		if (item->isLine())
+		{
+			const QPointF startPoint = item->asLine()->startPoint();
+			const QPointF endPoint = item->asLine()->endPoint();
+			const QPointF centerPoint = (startPoint + endPoint) / 2.0;
+			xAnchors = { startPoint.x(), centerPoint.x(), endPoint.x() };
+			yAnchors = { startPoint.y(), centerPoint.y(), endPoint.y() };
+		}
+	}
+
+	const double snapDistance = m_doc->guidesPrefs().guideRad / m_canvas->scale();
+	double bestXDistance = snapDistance;
+	double bestYDistance = snapDistance;
+	double bestXCorrection = 0.0;
+	double bestYCorrection = 0.0;
+	bool bestXDrawLine = false;
+	bool bestYDrawLine = false;
+	double bestXTarget = 0.0;
+	double bestYTarget = 0.0;
+	int bestXPage = -1;
+	int bestYPage = -1;
+
+	auto considerX = [&](double source, double target, bool drawLine, int snapPage)
+	{
+		const double correction = target - source;
+		const double distance = std::abs(correction);
+		if (distance < bestXDistance)
+		{
+			bestXDistance = distance;
+			bestXCorrection = correction;
+			bestXDrawLine = drawLine;
+			bestXTarget = target;
+			bestXPage = drawLine ? snapPage : -1;
+		}
+	};
+	auto considerY = [&](double source, double target, bool drawLine, int snapPage)
+	{
+		const double correction = target - source;
+		const double distance = std::abs(correction);
+		if (distance < bestYDistance)
+		{
+			bestYDistance = distance;
+			bestYCorrection = correction;
+			bestYDrawLine = drawLine;
+			bestYTarget = target;
+			bestYPage = drawLine ? snapPage : -1;
+		}
+	};
+	auto pageForPoint = [&](double x, double y, int fallbackPage)
+	{
+		const int pointPage = m_doc->OnPage(x, y);
+		return (pointPage >= 0) ? pointPage : fallbackPage;
+	};
+
+	const QRectF movedRect = visualRect.translated(rawDelta.x(), rawDelta.y());
+	const QPointF movedCenter = movedRect.center();
+	int pageIndex = m_doc->OnPage(movedCenter.x(), movedCenter.y());
+	if (pageIndex < 0)
+		pageIndex = m_doc->OnPage(m_view->m_mousePointDoc.x(), m_view->m_mousePointDoc.y());
+	const ScPage* page = (pageIndex >= 0) ? m_doc->Pages->at(pageIndex) : nullptr;
+
+	for (size_t i = 0; i < xAnchors.size(); ++i)
+	{
+		const double movedX = xAnchors[i] + rawDelta.x();
+		const double movedY = yAnchors[i] + rawDelta.y();
+
+		if (m_doc->SnapGuides && page)
+		{
+			double snappedX = movedX;
+			double snappedY = movedY;
+			m_doc->getClosestGuides(movedX, movedY, &snappedX, &snappedY, page);
+			if (snappedX != movedX)
+				considerX(movedX, snappedX, true, pageIndex);
+			if (snappedY != movedY)
+				considerY(movedY, snappedY, true, pageIndex);
+		}
+		if (m_doc->SnapItems)
+		{
+			double snappedX = movedX;
+			double snappedY = movedY;
+			m_doc->getClosestElementBorder(movedX, movedY, &snappedX, &snappedY, ScribusDoc::ExcludeSelection);
+			if (snappedX != movedX)
+				considerX(movedX, snappedX, true, pageForPoint(snappedX, movedY, pageIndex));
+			if (snappedY != movedY)
+				considerY(movedY, snappedY, true, pageForPoint(movedX, snappedY, pageIndex));
+		}
+		if ((m_doc->SnapGuides || m_doc->SnapItems) && page)
+		{
+			double snappedX = movedX;
+			double snappedY = movedY;
+			m_doc->getClosestPageBoundaries(movedX, movedY, snappedX, snappedY, page);
+			if (snappedX != movedX)
+				considerX(movedX, snappedX, true, pageIndex);
+			if (snappedY != movedY)
+				considerY(movedY, snappedY, true, pageIndex);
+
+			considerX(movedX, page->xOffset() + page->width() / 2.0, true, pageIndex);
+			considerY(movedY, page->yOffset() + page->height() / 2.0, true, pageIndex);
+		}
+		if (m_doc->SnapGrid && m_doc->OnPage(movedX, movedY) >= 0)
+		{
+			const FPoint snapped = m_doc->ApplyGridF(FPoint(movedX, movedY));
+			considerX(movedX, snapped.x(), false, -1);
+			considerY(movedY, snapped.y(), false, -1);
+		}
+	}
+
+	m_objectDeltaPos += FPoint(bestXCorrection, bestYCorrection);
+	if (bestXDrawLine)
+		setXSnapFeedback(bestXTarget, bestXPage);
+	if (bestYDrawLine)
+		setYSnapFeedback(bestYTarget, bestYPage);
+}
+
 void CanvasMode_Normal::drawControls(QPainter* p)
 {
 	// qDebug() << Q_FUNC_INFO;
@@ -108,6 +272,7 @@
 	m_mouseCurrentPoint.setXY(0, 0);
 	m_mouseSavedPoint.setXY(0, 0);
 	m_objectDeltaPos.setXY(0,0 );
+	clearSnapFeedback();
 	m_frameResizeHandle = -1;
 	m_shiftSelItems = false;
 	m_hoveredItem = nullptr;
@@ -541,14 +706,17 @@
 				else
 					m_view->setCursor(QCursor(Qt::ArrowCursor));
 				erf = false;
-				int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
+				double dX = newX - m_mousePressPoint.x();
+				double dY = newY - m_mousePressPoint.y();
+				clearSnapFeedback();
 				if (!m_doc->m_Selection->isMultipleSelection())
 				{
 					erf = true;
 					currItem = m_doc->m_Selection->itemAt(0);
-					//Control Alt drag image in frame without being in edit mode
-					if ((currItem->isImageFrame()) && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
+					// Control+Alt drags an image within its frame without entering image edit mode.
+					if (currItem->isImageFrame() && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
 					{
+						m_objectDeltaPos.setXY(0.0, 0.0);
 						QTransform mm1 = currItem->getTransform();
 						QTransform mm2 = mm1.inverted();
 						QPointF rota = mm2.map(QPointF(newX, newY)) - mm2.map(QPointF(m_mouseSavedPoint.x(), m_mouseSavedPoint.y()));
@@ -558,166 +726,36 @@
 					}
 					else
 					{
-						//Dragging orthogonally - Ctrl Drag
+						// Drag orthogonally with Control.
 						if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
 						{
-							if (abs(dX) > abs(dY))
-								dY = 0;
-							else if (abs(dY) > abs(dX))
-								dX = 0;
+							if (std::abs(dX) > std::abs(dY))
+								dY = 0.0;
+							else if (std::abs(dY) > std::abs(dX))
+								dX = 0.0;
 							erf = false;
-							dX += qRound(m_dragConstrainInitPtX - currItem->xPos());
-							dY += qRound(m_dragConstrainInitPtY - currItem->yPos());
-						}
-						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
-						// the various types of items
-						if (currItem->isLine())
-						{
-							QPointF startPoint = currItem->asLine()->startPoint();
-							QPointF endPoint   = currItem->asLine()->endPoint();
-							gx = qMin(startPoint.x(), endPoint.x());
-							gy = qMin(startPoint.y(), endPoint.y());
-							gw = fabs(startPoint.x() - endPoint.x());
-							gh = fabs(startPoint.y() - endPoint.y());
-						}
-						if (m_doc->SnapGuides)
-						{
-							double nx = gx + m_objectDeltaPos.x();
-							double ny = gy + m_objectDeltaPos.y();
-							double nxo = nx, nyo = ny;
-							m_doc->ApplyGuides(&nx, &ny);
-							m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-							nx = nxo = gx + gw + m_objectDeltaPos.x();
-							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->SnapItems)
-						{
-							xSnap = 0;
-							ySnap = 0;
-							double snapWidth[] = { 0, gw, gw / 2 };
-							double snapHeight[] = { 0, gh, gh / 2 };
-							if (m_objectDeltaPos.x() < 0)
-								std::swap(snapWidth[0], snapWidth[2]);
-							if (m_objectDeltaPos.y() < 0)
-								std::swap(snapHeight[0], snapHeight[2]);
-							double nx,ny,nyo,nxo;
-							for (int i = 0; i < 3; i++)
-							{
-								nx = gx + snapWidth[i] + m_objectDeltaPos.x();
-								ny = gy + snapHeight[i] + m_objectDeltaPos.y();
-								nxo = nx, nyo = ny;
-								m_doc->ApplyGuides(&nx, &ny,true);
-								m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-								if (ny != nyo)
-									ySnap = ny;
-								if (nx != nxo)
-									xSnap = nx;
-							}
-						}
-						if (m_doc->SnapGrid)
-						{
-							double gx, gy, gh, gw, gxo, gyo;
-							m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-							gx += m_objectDeltaPos.x();
-							gy += m_objectDeltaPos.y();
-							gxo = gx;
-							gyo = gy;
-							QRectF nr  = m_doc->ApplyGridF(QRectF(gx, gy, gw, gh));
-							gx = nr.x();
-							gy = nr.y();
-							if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
-								m_objectDeltaPos += FPoint(gx - gxo, gy - gyo);
+							dX += m_dragConstrainInitPtX - currItem->xPos();
+							dY += m_dragConstrainInitPtY - currItem->yPos();
 						}
+						updateMovementSnap(FPoint(dX, dY));
 					}
 				}
 				else
 				{
 					double gx, gy, gh, gw;
 					m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-					int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
 					erf = true;
 					if (m->modifiers() & Qt::ControlModifier)
 					{
-						if (abs(dX) > abs(dY))
-							dY = 0;
-						else if (abs(dY) > abs(dX))
-							dX = 0;
+						if (std::abs(dX) > std::abs(dY))
+							dY = 0.0;
+						else if (std::abs(dY) > std::abs(dX))
+							dX = 0.0;
 						erf = false;
-						dX += m_dragConstrainInitPtX-qRound(gx);
-						dY += m_dragConstrainInitPtY-qRound(gy);
-					}
-					m_objectDeltaPos.setXY(dX, dY);
-					if (m_doc->SnapGuides)
-					{
-						double nx = gx + m_objectDeltaPos.x();
-						double ny = gy + m_objectDeltaPos.y();
-						double nxo = nx, nyo = ny;
-						m_doc->ApplyGuides(&nx, &ny);
-						m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-						nx = nxo = gx + gw + m_objectDeltaPos.x();
-						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->SnapItems)
-					{
-						xSnap = 0;
-						ySnap = 0;
-						double snapWidth[] = { 0, gw, gw / 2 };
-						double snapHeight[] = { 0, gh, gh / 2 };
-						if (m_objectDeltaPos.x() <0 )
-							std::swap(snapWidth[0], snapWidth[2]);
-						if (m_objectDeltaPos.y() < 0)
-							std::swap(snapHeight[0], snapHeight[2]);
-						double nx,ny,nyo,nxo;
-						for (int i = 0; i < 3; i++)
-						{
-							nx = gx + snapWidth[i] + m_objectDeltaPos.x();
-							ny = gy + snapHeight[i] + m_objectDeltaPos.y();
-							nxo = nx, nyo = ny;
-							m_doc->ApplyGuides(&nx, &ny,true);
-							m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
-							if (ny != nyo)
-								ySnap = ny;
-							if (nx != nxo)
-								xSnap = nx;
-						}
-					}
-					if (m_doc->SnapGrid)
-					{
-						double gx, gy, gh, gw, gxo, gyo;
-						m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-						gx += m_objectDeltaPos.x();
-						gy += m_objectDeltaPos.y();
-						gxo = gx;
-						gyo = gy;
-						QRectF nr = m_doc->ApplyGridF(QRectF(gx, gy, gw, gh));
-						gx = nr.x();
-						gy = nr.y();
-						if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
-							m_objectDeltaPos += FPoint(gx - gxo, gy - gyo);
+						dX += m_dragConstrainInitPtX - gx;
+						dY += m_dragConstrainInitPtY - gy;
 					}
+					updateMovementSnap(FPoint(dX, dY));
 				}
 				if (erf)
 				{
@@ -727,22 +765,46 @@
 				{
 					double gx, gy, gh, gw;
 					m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-					m_doc->adjustCanvas(FPoint(gx,gy), FPoint(gx + gw, gy + gh));
+					gx += m_objectDeltaPos.x();
+					gy += m_objectDeltaPos.y();
 					QPoint selectionCenter = m_canvas->canvasToLocal(QPointF(gx + gw / 2, gy + gh / 2));
 					QPoint localMousePos = m_canvas->canvasToLocal(mousePointDoc);
 					int localwidth = static_cast<int>(gw * m_canvas->scale());
 					int localheight = static_cast<int>(gh * m_canvas->scale());
-					if (localwidth > 200)
+					const int viewportWidth = m_view->viewport()->width();
+					const int viewportHeight = m_view->viewport()->height();
+					const int usableWidth = qMax(0, viewportWidth - 2 * kDragAutoScrollMargin);
+					const int usableHeight = qMax(0, viewportHeight - 2 * kDragAutoScrollMargin);
+					if (localwidth > usableWidth)
 					{
 						localwidth = 0;
 						selectionCenter.setX(localMousePos.x());
 					}
-					if (localheight > 200)
+					if (localheight > usableHeight)
 					{
 						localheight = 0;
 						selectionCenter.setY(localMousePos.y());
 					}
-					m_view->ensureVisible(selectionCenter.x(), selectionCenter.y(), localwidth / 2 + 20, localheight / 2 + 20);
+
+					QScrollBar* hBar = m_view->horizontalScrollBar();
+					QScrollBar* vBar = m_view->verticalScrollBar();
+					const DragAutoScrollResult hScroll = dragAutoScrollValue(hBar, selectionCenter.x(),
+						localwidth / 2 + kDragAutoScrollMargin, viewportWidth);
+					const DragAutoScrollResult vScroll = dragAutoScrollValue(vBar, selectionCenter.y(),
+						localheight / 2 + kDragAutoScrollMargin, viewportHeight);
+					if (hScroll.residual != 0)
+					{
+						m_objectDeltaPos.setX(m_objectDeltaPos.x() - hScroll.residual / m_canvas->scale());
+						clearXSnapFeedback();
+					}
+					if (vScroll.residual != 0)
+					{
+						m_objectDeltaPos.setY(m_objectDeltaPos.y() - vScroll.residual / m_canvas->scale());
+						clearYSnapFeedback();
+					}
+					hBar->setValue(hScroll.value);
+					vBar->setValue(vScroll.value);
+
 					m_canvas->repaint();
 					m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 					m_canvas->displayCorrectedXYHUD(m->globalPosition(), gx + m_objectDeltaPos.x(), gy + m_objectDeltaPos.y());
@@ -904,8 +966,8 @@
 		double gx, gy, gh, gw;
 		bool shiftSel = true;
 		m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-		m_dragConstrainInitPtX = qRound(gx);
-		m_dragConstrainInitPtY = qRound(gy);
+		m_dragConstrainInitPtX = gx;
+		m_dragConstrainInitPtY = gy;
 		m_frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
 		if (m_frameResizeHandle == Canvas::OUTSIDE ||
 			(m_frameResizeHandle == Canvas::INSIDE && m->modifiers() != Qt::NoModifier))
@@ -1093,49 +1155,12 @@
 			if (m_doc->m_Selection->isMultipleSelection())
 			{
 				m_doc->moveGroup(m_objectDeltaPos.x(), m_objectDeltaPos.y());
-				double gx, gy, gh, gw;
-				m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-				double nx = gx;
-				double ny = gy;
-				if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
-				{
-					QRectF nr  = m_doc->ApplyGridF(QRectF(gx, gy, gw, gh));
-					nx = nr.x();
-					ny = nr.y();
-				}
-				m_doc->moveGroup(nx - gx, ny - gy);
-				m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-				nx = gx + gw;
-				ny = gy + gh;
-				if (m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
-					m_doc->moveGroup(nx - (gx + gw), ny - (gy + gh));
 				m_doc->m_Selection->setGroupRect();
 			}
 			else
 			{
 				currItem = m_doc->m_Selection->itemAt(0);
 				m_doc->moveItem(m_objectDeltaPos.x(), m_objectDeltaPos.y(), currItem);
-				if (m_doc->SnapGrid)
-				{
-					double nx = currItem->xPos();
-					double ny = currItem->yPos();
-					if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
-					{
-						double gx, gy, gh, gw, gxo, gyo;
-						m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-						gxo = gx;
-						gyo = gy;
-						QRectF nr = m_doc->ApplyGridF(QRectF(gx, gy, gw, gh));
-						gx = nr.x();
-						gy = nr.y();
-						if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
-						{
-							nx += (gx - gxo);
-							ny += (gy - gyo);
-						}
-					}
-					m_doc->moveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
-				}
 			}
 			m_canvas->m_viewMode.operItemMoving = false;
 			if (m_doc->m_Selection->isMultipleSelection())
@@ -1266,7 +1291,7 @@
 	else
 		m_view->deselectItems(true);
 
-	xSnap = ySnap = 0;
+	clearSnapFeedback();
 	m_canvas->setRenderModeUseBuffer(false);
 	m_doc->DragP = false;
 	m_doc->leaveDrag = false;
Index: scribus/canvasmode_normal.h
===================================================================
--- scribus/canvasmode_normal.h	(revision 27881)
+++ scribus/canvasmode_normal.h	(working copy)
@@ -78,6 +78,7 @@
 	void handleMouseEnter(PageItem* currItem);
 	bool SeleItem(QMouseEvent *m);
 	void createContextMenu(PageItem *currItem, double mx, double my);
+	void updateMovementSnap(const FPoint& rawDelta);
 
 	FPoint m_mousePressPoint;
 	FPoint m_mouseCurrentPoint;
@@ -91,8 +92,8 @@
 	ScribusMainWindow* m_ScMW {nullptr};
 	bool m_lastPosWasOverGuide {false};
 	bool m_shiftSelItems {false};
-	int m_dragConstrainInitPtX {0};
-	int m_dragConstrainInitPtY {0};
+	double m_dragConstrainInitPtX {0.0};
+	double m_dragConstrainInitPtY {0.0};
 	int m_frameResizeHandle {-1};
 
 public slots:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 27881)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -14806,12 +14806,10 @@
 
 void ScribusDoc::getClosestElementBorder(double xin, double yin, double *xout, double *yout, SelectionSkipBehavior behavior)
 {
-	int gxM = -1;
-	int gyM = -1;
-	QMap<double, uint> tmpGuidesSelX;
-	QMap<double, uint> tmpGuidesSelY;
 	double viewScale = m_View->scale();
 	const double snappingDistance = prefsData().guidesPrefs.guideRad / viewScale;
+	double closestXDistance = snappingDistance;
+	double closestYDistance = snappingDistance;
 
 	*xout = xin;
 	*yout = yin;
@@ -14830,46 +14828,28 @@
 		if (items.at(i)->Parent != parentI)
 			continue;
 
-		double visualXPos = items.at(i)->visualXPos();
-		double visualYPos = items.at(i)->visualYPos();
-		double visualWidth = items.at(i)->visualWidth();
-		double visualHeight = items.at(i)->visualHeight();
-
-		if (fabs(visualXPos - xin) < snappingDistance)
-			tmpGuidesSelX.insert(fabs(visualXPos - xin), i * 3);
-		else if (fabs(visualXPos + visualWidth - xin) < snappingDistance)
-			tmpGuidesSelX.insert(fabs(visualXPos + visualWidth - xin), i * 3 + 1);
-		else if (fabs(visualXPos + visualWidth / 2 - xin) < snappingDistance)
-			tmpGuidesSelX.insert(fabs(visualXPos + visualWidth / 2 - xin), i * 3 + 2);
-
-		if (fabs(visualYPos - yin) < snappingDistance)
-			tmpGuidesSelY.insert(fabs(visualYPos - yin), i * 3);
-		else if (fabs(visualYPos + visualHeight - yin) < snappingDistance)
-			tmpGuidesSelY.insert(fabs(visualYPos + visualHeight - yin), i * 3 + 1);
-		else if (fabs(visualYPos + visualHeight / 2 - yin) < snappingDistance)
-			tmpGuidesSelY.insert(fabs(visualYPos + visualHeight / 2 - yin), i * 3 + 2);
-	}
-
-	if (!tmpGuidesSelX.isEmpty())
-	{
-		gxM = tmpGuidesSelX.begin().value();
-		if (gxM % 3 == 0)
-			*xout = items.at(gxM / 3)->visualXPos();
-		else if (gxM % 3 == 1)
-			*xout = items.at(gxM / 3)->visualXPos() + items.at(gxM / 3)->visualWidth();
-		else if (gxM % 3 == 2)
-			*xout = items.at(gxM / 3)->visualXPos() + items.at(gxM / 3)->visualWidth() / 2;
-	}
-
-	if (!tmpGuidesSelY.isEmpty())
-	{
-		gyM = tmpGuidesSelY.begin().value();
-		if (gyM % 3 == 0)
-			*yout = items.at(gyM / 3)->visualYPos();
-		else if (gyM % 3 == 1)
-			*yout = items.at(gyM / 3)->visualYPos() + items.at(gyM / 3)->visualHeight();
-		else if (gyM % 3 == 2)
-			*yout = items.at(gyM / 3)->visualYPos() + items.at(gyM / 3)->visualHeight() / 2;
+		const QRectF visualRect = items.at(i)->getVisualBoundingRect();
+		const std::array<double, 3> xTargets { visualRect.left(), visualRect.center().x(), visualRect.right() };
+		const std::array<double, 3> yTargets { visualRect.top(), visualRect.center().y(), visualRect.bottom() };
+
+		for (double target : xTargets)
+		{
+			const double distance = fabs(target - xin);
+			if (distance < closestXDistance)
+			{
+				closestXDistance = distance;
+				*xout = target;
+			}
+		}
+		for (double target : yTargets)
+		{
+			const double distance = fabs(target - yin);
+			if (distance < closestYDistance)
+			{
+				closestYDistance = distance;
+				*yout = target;
+			}
+		}
 	}
 }
 
@@ -14884,46 +14864,44 @@
 
 	xout = xin;
 	yout = yin;
+	double closestXDistance = snapDistance;
+	double closestYDistance = snapDistance;
 
-	// Left
-	if (fabs(page->xOffset() - bleedValues.left() - xin) < snapDistance)
-		xout = page->xOffset() - bleedValues.left();
-
-	if (fabs(page->Margins.left() + page->xOffset() - xin) < snapDistance)
-		xout = page->xOffset() + page->Margins.left();
-
-	if (fabs(page->xOffset() - xin) < snapDistance)
-		xout = page->xOffset();
-
-	// Right
-	if (fabs(page->width() + bleedValues.right() + page->xOffset() - xin) < snapDistance)
-		xout = page->xOffset() + page->width() + bleedValues.right();
-
-	if (fabs((page->width() - page->Margins.right()) + page->xOffset() - xin) < snapDistance)
-		xout = page->xOffset() + page->width() - page->Margins.right();
+	const std::array<double, 6> xTargets {
+		page->xOffset() - bleedValues.left(),
+		page->xOffset(),
+		page->xOffset() + page->Margins.left(),
+		page->xOffset() + page->width() - page->Margins.right(),
+		page->xOffset() + page->width(),
+		page->xOffset() + page->width() + bleedValues.right()
+	};
+	const std::array<double, 6> yTargets {
+		page->yOffset() - bleedValues.top(),
+		page->yOffset(),
+		page->yOffset() + page->Margins.top(),
+		page->yOffset() + page->height() - page->Margins.bottom(),
+		page->yOffset() + page->height(),
+		page->yOffset() + page->height() + bleedValues.bottom()
+	};
 
-	if (fabs((page->width() + page->xOffset()) - xin) < snapDistance)
-		xout = page->xOffset() + page->width();
-
-	// Top side
-	if (fabs(page->height() + bleedValues.bottom() + page->yOffset() - yin) < snapDistance)
-		yout = page->yOffset() + page->height() + bleedValues.bottom();
-
-	if (fabs(page->Margins.top() + page->yOffset() - yin) < snapDistance)
-		yout = page->yOffset() + page->Margins.top();
-
-	if (fabs(page->yOffset() - yin) < snapDistance)
-		yout = page->yOffset();
-
-	// Bottom
-	if (fabs(page->yOffset() - bleedValues.top() - yin) < snapDistance)
-		yout = page->yOffset() - bleeds()->top();
-
-	if (fabs((page->height() - page->Margins.bottom()) + page->yOffset() - yin) < snapDistance)
-		yout = page->yOffset() + page->height() - page->Margins.bottom();
-
-	if (fabs((page->height() + page->yOffset()) - yin) < snapDistance)
-		yout =  page->yOffset() + page->height();
+	for (double target : xTargets)
+	{
+		const double distance = fabs(target - xin);
+		if (distance < closestXDistance)
+		{
+			closestXDistance = distance;
+			xout = target;
+		}
+	}
+	for (double target : yTargets)
+	{
+		const double distance = fabs(target - yin);
+		if (distance < closestYDistance)
+		{
+			closestYDistance = distance;
+			yout = target;
+		}
+	}
 }
 
 void ScribusDoc::SnapToGuides(PageItem *currItem)
Index: scribus/selection.cpp
===================================================================
--- scribus/selection.cpp	(revision 27881)
+++ scribus/selection.cpp	(working copy)
@@ -507,7 +507,7 @@
 QRectF Selection::getVisualGroupRect()
 {
 	double x, y, w, h;
-	getGroupRect(&x, &y, &w, &h);
+	getVisualGroupRect(&x, &y, &w, &h);
 	return QRectF(x, y, w, h);
 }
 
omi3-live-object-movement-v1.06.patch (18,821 bytes)   
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp	(revision 27881)
+++ scribus/canvas.cpp	(working copy)
@@ -1473,11 +1473,24 @@
 			if (currItem->OnMasterPage != m_doc->currentPage()->pageName())
 				continue;
 		}
-		if (cullingArea.intersects(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0)))
-		{
-			if ((m_viewMode.operItemMoving || m_viewMode.drawSelectedItemsWithControls) && currItem->isSelected())
-			{
-//					qDebug() << "skipping pageitem (move/resizeEdit/selected)" << m_viewMode.operItemMoving << currItem->isSelected();
+		const bool liveMove = m_viewMode.liveMovePreview && currItem->isSelected();
+		QRectF itemBounds = currItem->getBoundingRect();
+		if (liveMove)
+			itemBounds.translate(m_viewMode.movePreviewOffset);
+		if (cullingArea.intersects(itemBounds.adjusted(0.0, 0.0, 1.0, 1.0)))
+		{
+			if (((m_viewMode.operItemMoving && !m_viewMode.liveMovePreview) || m_viewMode.drawSelectedItemsWithControls) && currItem->isSelected())
+			{
+//					qDebug() << "skipping pageitem (resizeEdit/selected)" << currItem->isSelected();
+			}
+			else if (liveMove)
+			{
+				const QRectF translatedCulling = cullingArea.translated(-m_viewMode.movePreviewOffset);
+				painter->save();
+				painter->translate(m_viewMode.movePreviewOffset.x(), m_viewMode.movePreviewOffset.y());
+				currItem->DrawObj(painter, translatedCulling);
+				currItem->DrawObj_Decoration(painter);
+				painter->restore();
 			}
 			else if (m_viewMode.operItemSelecting)
 			{
@@ -2142,6 +2155,8 @@
 	{
 		PageItem* next = curr->nextInChain();
 		FrameLinkRouter router(curr, next, m_viewMode.scale);
+		if (m_viewMode.liveMovePreview)
+			router.setSelectedItemsOffset(FPoint(m_viewMode.movePreviewOffset.x(), m_viewMode.movePreviewOffset.y()));
 		router.setSourceIsAlsoEntry(curr->prevInChain() != nullptr);
 		router.setDestinationIsAlsoExit(next->nextInChain() != nullptr);
 		router.route();
Index: scribus/canvas.h
===================================================================
--- scribus/canvas.h	(revision 27881)
+++ scribus/canvas.h	(working copy)
@@ -61,6 +61,10 @@
 	bool drawSelectedItemsWithControls {false};
 	/** if true, drawContents() will draw framelinks even if View->Show Framelinks is false */
 	bool drawFramelinksWithContents {false};
+	/** if true, selected items are rendered at movePreviewOffset during a live drag */
+	bool liveMovePreview {false};
+	/** Temporary document-space offset used to render selected items during a live drag. */
+	QPointF movePreviewOffset;
 	// used for buffering:
 	bool forceRedraw {false};
 	double scale {1};
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 27881)
+++ scribus/canvasmode.cpp	(working copy)
@@ -230,12 +230,13 @@
 	psx->fillRect(markerRect, pen.color());
 }
 
-void CanvasMode::drawSelection(QPainter* psx, bool drawHandles)
+void CanvasMode::drawSelection(QPainter* psx, bool drawHandles, const QPointF& offset, bool drawCenterMarker)
 {
 	psx->scale(m_canvas->scale(), m_canvas->scale());
 	psx->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
 	psx->setClipping(true);
 	psx->setClipRegion(QRegion(m_canvas->exposedRect()));
+	psx->translate(offset);
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
 		PageItem *curItem(nullptr);
@@ -293,11 +294,9 @@
 		psx->setBrush(m_brush["selection-group"]);
 		psx->drawRect(QRectF(x, y, w, h));
 		if (drawHandles)
-		{
 			drawSelectionHandles(psx, QRectF(x, y, w, h));
-			if (m_doc->appMode == modeNormal)
-				drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
-		}
+		if ((drawHandles || drawCenterMarker) && (m_doc->appMode == modeNormal))
+			drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
 		psx->restore();
 	}
 	else if (m_doc->m_Selection->isNotEmpty())
@@ -338,11 +337,9 @@
 					psx->setBrush(m_brush["selection-group-inside"]);
 					psx->drawRect(drRect);
 					if (drawHandles)
-					{
 						drawSelectionHandles(psx, QRectF(x, y, w, h), true);
-						if (m_doc->appMode == modeNormal)
-							drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-group-inside"), m_canvas->scale());
-					}
+					if ((drawHandles || drawCenterMarker) && (m_doc->appMode == modeNormal))
+						drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-group-inside"), m_canvas->scale());
 				}
 			}
 			else
@@ -389,9 +386,9 @@
 					}
 					else
 						drawSelectionHandles(psx, QRectF(x, y, w, h));
-					if (m_doc->appMode == modeNormal)
-						drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
 				}
+				if ((drawHandles || drawCenterMarker) && !currItem->locked() && (m_doc->appMode == modeNormal))
+					drawSelectionCenterMarker(psx, QRectF(x, y, w, h).center(), m_pen.value("selection-handle"), m_canvas->scale());
 				if (currItem->isWelded())
 				{
 					for (int i = 0 ; i <  currItem->weldList.count(); i++)
Index: scribus/canvasmode.h
===================================================================
--- scribus/canvasmode.h	(revision 27881)
+++ scribus/canvasmode.h	(working copy)
@@ -134,7 +134,7 @@
 	/** Draws the handles for the selection marker */
 	void drawSelectionHandles(QPainter *psx, QRectF selectionRect, bool insideGroup = false);
 	/** Draws the regular selection marker */
-	void drawSelection(QPainter* psx, bool drawHandles);
+	void drawSelection(QPainter* psx, bool drawHandles, const QPointF& offset = QPointF(), bool drawCenterMarker = false);
 	/** Draws an outline of selected items */
 	void drawSnapLine(QPainter* psx);
 	/** Draws an outline of selected items */
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp	(revision 27881)
+++ scribus/canvasmode_normal.cpp	(working copy)
@@ -66,6 +66,7 @@
 namespace
 {
 constexpr int kDragAutoScrollMargin = 10;
+constexpr int kMovementPreviewDirtyPadding = 8;
 constexpr double kDragAutoScrollFactor = 0.75;
 
 struct DragAutoScrollResult
@@ -93,6 +94,20 @@
 	const int value = qBound(scrollBar->minimum(), current + step, scrollBar->maximum());
 	return { value, desired - value };
 }
+
+bool containsLinkedTextFrame(const PageItem* item)
+{
+	if (item->isTextFrame() && (item->prevInChain() || item->nextInChain()))
+		return true;
+	if (!item->isGroup())
+		return false;
+	for (const PageItem* child : item->groupItemList)
+	{
+		if (containsLinkedTextFrame(child))
+			return true;
+	}
+	return false;
+}
 }
 
 CanvasMode_Normal::CanvasMode_Normal(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW) 
@@ -105,6 +120,18 @@
 	return (*pi) != nullptr;
 }
 
+bool CanvasMode_Normal::canRenderLiveMovePreview() const
+{
+	for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+	{
+		// Group-child moves are committed in local group coordinates; keep the
+		// established outline preview until that transform path is unified.
+		if (m_doc->m_Selection->itemAt(i)->isGroupChild())
+			return false;
+	}
+	return !m_doc->m_Selection->isEmpty();
+}
+
 void CanvasMode_Normal::updateMovementSnap(const FPoint& rawDelta)
 {
 	m_objectDeltaPos = rawDelta;
@@ -234,11 +261,55 @@
 		setYSnapFeedback(bestYTarget, bestYPage);
 }
 
+void CanvasMode_Normal::repaintMovementPreview(const FPoint& oldDelta, bool refreshControls)
+{
+	double gx, gy, gw, gh;
+	m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
+	QRectF oldRect(gx + oldDelta.x(), gy + oldDelta.y(), gw, gh);
+	QRectF newRect(gx + m_objectDeltaPos.x(), gy + m_objectDeltaPos.y(), gw, gh);
+
+	bool redrawFrameLinks = false;
+	if (m_doc->guidesPrefs().linkShown)
+	{
+		for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+		{
+			if (containsLinkedTextFrame(m_doc->m_Selection->itemAt(i)))
+			{
+				redrawFrameLinks = true;
+				break;
+			}
+		}
+	}
+
+	m_canvas->m_viewMode.forceRedraw = true;
+	if (redrawFrameLinks)
+		m_canvas->repaint();
+	else
+	{
+		QRect dirty = m_canvas->canvasToLocal(oldRect.united(newRect));
+		m_canvas->repaint(dirty.adjusted(-kMovementPreviewDirtyPadding, -kMovementPreviewDirtyPadding, kMovementPreviewDirtyPadding, kMovementPreviewDirtyPadding));
+	}
+
+	// Snap lines are controls painted over the content buffer. Repaint once more
+	// from the refreshed buffer so a previous full-page snap line cannot linger.
+	if (refreshControls && !redrawFrameLinks)
+		m_canvas->repaint();
+}
+
 void CanvasMode_Normal::drawControls(QPainter* p)
 {
 	// qDebug() << Q_FUNC_INFO;
 	if (m_canvas->m_viewMode.operItemMoving)
-		drawOutline(p, m_objectDeltaPos.x(), m_objectDeltaPos.y());
+	{
+		if (m_canvas->m_viewMode.liveMovePreview)
+		{
+			p->save();
+			drawSelection(p, false, QPointF(m_objectDeltaPos.x(), m_objectDeltaPos.y()), true);
+			p->restore();
+		}
+		else
+			drawOutline(p, m_objectDeltaPos.x(), m_objectDeltaPos.y());
+	}
 	else
 		drawSelection(p, !m_doc->drawAsPreview);
 }
@@ -272,10 +343,14 @@
 	m_mouseCurrentPoint.setXY(0, 0);
 	m_mouseSavedPoint.setXY(0, 0);
 	m_objectDeltaPos.setXY(0,0 );
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
 	clearSnapFeedback();
 	m_frameResizeHandle = -1;
 	m_shiftSelItems = false;
 	m_hoveredItem = nullptr;
+	m_imageMoveInProgress = false;
+	m_moveCancelled = false;
 	setModeCursor();
 	if (fromGesture)
 	{
@@ -286,6 +361,9 @@
 void CanvasMode_Normal::deactivate(bool forGesture)
 {
 	// qDebug() << Q_FUNC_INFO << forGesture;
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
+	m_imageMoveInProgress = false;
 	m_view->setRedrawMarkerShown(false);
 	CanvasMode::deactivate(forGesture);
 }
@@ -700,7 +778,10 @@
 				//Dragging an item (plus more?)
 				newX = mousePointDoc.x();
 				newY = mousePointDoc.y();
+				const FPoint oldDelta = m_objectDeltaPos;
+				const bool hadSnapLine = hasSnapFeedback();
 				m_canvas->m_viewMode.operItemMoving = true;
+				m_canvas->setRenderMode(Canvas::RENDER_NORMAL);
 				if (!(m_doc->drawAsPreview && !m_doc->editOnPreview))
 					m_view->setCursor(Qt::ClosedHandCursor);
 				else
@@ -716,6 +797,7 @@
 					// Control+Alt drags an image within its frame without entering image edit mode.
 					if (currItem->isImageFrame() && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
 					{
+						m_imageMoveInProgress = true;
 						m_objectDeltaPos.setXY(0.0, 0.0);
 						QTransform mm1 = currItem->getTransform();
 						QTransform mm2 = mm1.inverted();
@@ -726,6 +808,7 @@
 					}
 					else
 					{
+						m_imageMoveInProgress = false;
 						// Drag orthogonally with Control.
 						if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
 						{
@@ -742,6 +825,7 @@
 				}
 				else
 				{
+					m_imageMoveInProgress = false;
 					double gx, gy, gh, gw;
 					m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
 					erf = true;
@@ -761,6 +845,8 @@
 				{
 					m_mouseCurrentPoint.setXY(newX, newY);
 				}
+
+				const bool livePreview = canRenderLiveMovePreview();
 				
 				{
 					double gx, gy, gh, gw;
@@ -802,10 +888,17 @@
 						m_objectDeltaPos.setY(m_objectDeltaPos.y() - vScroll.residual / m_canvas->scale());
 						clearYSnapFeedback();
 					}
+
+					m_canvas->m_viewMode.liveMovePreview = livePreview;
+					m_canvas->m_viewMode.movePreviewOffset = livePreview
+						? QPointF(m_objectDeltaPos.x(), m_objectDeltaPos.y()) : QPointF();
 					hBar->setValue(hScroll.value);
 					vBar->setValue(vScroll.value);
 
-					m_canvas->repaint();
+					if (livePreview)
+						repaintMovementPreview(oldDelta, hadSnapLine || hasSnapFeedback());
+					else
+						m_canvas->repaint();
 					m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 					m_canvas->displayCorrectedXYHUD(m->globalPosition(), gx + m_objectDeltaPos.x(), gy + m_objectDeltaPos.y());
 				}
@@ -906,6 +999,10 @@
 	PageItem *currItem;
 
 	m_objectDeltaPos  = FPoint(0, 0);
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
+	m_imageMoveInProgress = false;
+	m_moveCancelled = false;
 	m_mousePressPoint = m_mouseCurrentPoint = mousePointDoc;
 	m_mouseSavedPoint = mousePointDoc;
 	m_canvas->m_viewMode.m_MouseButtonPressed = true;
@@ -1082,6 +1179,19 @@
 	m_canvas->resetRenderMode();
 	m->accept();
 	m_view->setRedrawMarkerShown(false);
+	if (m_moveCancelled)
+	{
+		m_imageMoveInProgress = false;
+		m_moveCancelled = false;
+		m_canvas->m_viewMode.liveMovePreview = false;
+		m_canvas->m_viewMode.movePreviewOffset = QPointF();
+		m_canvas->m_viewMode.operItemMoving = false;
+		m_canvas->m_viewMode.operItemResizing = false;
+		m_doc->DragP = false;
+		m_doc->leaveDrag = false;
+		setModeCursor();
+		return;
+	}
 //	m_view->stopDragTimer();
 	//m_canvas->update(); //ugly in a mouseReleaseEvent!!!!!!!
 
@@ -1133,6 +1243,11 @@
 		}
 		if (m_canvas->m_viewMode.operItemMoving)
 		{
+			// The document is still at its original position during the preview.
+			// Drop the view-only offset before committing the real move once.
+			m_canvas->m_viewMode.liveMovePreview = false;
+			m_canvas->m_viewMode.movePreviewOffset = QPointF();
+
 			// we want to invalidate all frames under the moved frame
 			// hm, I will try to be more explicit :) - pm
 			int itemIndex = m_doc->Items->count();
@@ -1292,6 +1407,10 @@
 		m_view->deselectItems(true);
 
 	clearSnapFeedback();
+	m_objectDeltaPos.setXY(0.0, 0.0);
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
+	m_imageMoveInProgress = false;
 	m_canvas->setRenderModeUseBuffer(false);
 	m_doc->DragP = false;
 	m_doc->leaveDrag = false;
@@ -1617,6 +1736,31 @@
 
 void CanvasMode_Normal::keyPressEvent(QKeyEvent *e)
 {
+	if ((e->key() == Qt::Key_Escape) && m_canvas->m_viewMode.operItemMoving && !m_imageMoveInProgress)
+	{
+		const FPoint oldDelta = m_objectDeltaPos;
+		const bool hadSnapLine = hasSnapFeedback();
+		const bool hadLivePreview = m_canvas->m_viewMode.liveMovePreview;
+		m_objectDeltaPos.setXY(0.0, 0.0);
+		m_canvas->m_viewMode.liveMovePreview = false;
+		m_canvas->m_viewMode.movePreviewOffset = QPointF();
+		m_canvas->m_viewMode.operItemMoving = false;
+		m_canvas->m_viewMode.m_MouseButtonPressed = false;
+		clearSnapFeedback();
+		m_doc->DragP = false;
+		m_doc->leaveDrag = false;
+		m_view->stopAllDrags();
+		m_canvas->setRenderMode(Canvas::RENDER_NORMAL);
+		if (hadLivePreview)
+			repaintMovementPreview(oldDelta, hadSnapLine);
+		else
+			m_canvas->repaint();
+		m_moveCancelled = true;
+		setModeCursor();
+		e->accept();
+		return;
+	}
+
 	commonkeyPressEvent_NormalNodeEdit(e);
 }
 
Index: scribus/canvasmode_normal.h
===================================================================
--- scribus/canvasmode_normal.h	(revision 27881)
+++ scribus/canvasmode_normal.h	(working copy)
@@ -78,6 +78,8 @@
 	void handleMouseEnter(PageItem* currItem);
 	bool SeleItem(QMouseEvent *m);
 	void createContextMenu(PageItem *currItem, double mx, double my);
+	bool canRenderLiveMovePreview() const;
+	void repaintMovementPreview(const FPoint& oldDelta, bool refreshControls);
 	void updateMovementSnap(const FPoint& rawDelta);
 
 	FPoint m_mousePressPoint;
@@ -90,7 +92,9 @@
 	ResizeGesture* m_resizeGesture {nullptr};
 	RulerGesture* m_guideMoveGesture {nullptr};
 	ScribusMainWindow* m_ScMW {nullptr};
+	bool m_imageMoveInProgress {false};
 	bool m_lastPosWasOverGuide {false};
+	bool m_moveCancelled {false};
 	bool m_shiftSelItems {false};
 	double m_dragConstrainInitPtX {0.0};
 	double m_dragConstrainInitPtY {0.0};
Index: scribus/framelinkrouter.cpp
===================================================================
--- scribus/framelinkrouter.cpp	(revision 27881)
+++ scribus/framelinkrouter.cpp	(working copy)
@@ -236,6 +236,17 @@
 		y2 = y1 + item->height() * grScYi;
 	}
 
+	bool movesWithSelection = item->isSelected();
+	for (PageItem* ancestor = item->Parent; ancestor && !movesWithSelection; ancestor = ancestor->Parent)
+		movesWithSelection = ancestor->isSelected();
+	if (movesWithSelection)
+	{
+		x1 += m_selectedItemsOffset.x();
+		y1 += m_selectedItemsOffset.y();
+		x2 += m_selectedItemsOffset.x();
+		y2 += m_selectedItemsOffset.y();
+	}
+
 	// The pivot point is (x1, y1) — Scribus's xPos/yPos is the rotation
 	// origin. Width and height define the unrotated frame size.
 	// We compute the 4 corners by rotating offsets from the pivot.
Index: scribus/framelinkrouter.h
===================================================================
--- scribus/framelinkrouter.h	(revision 27881)
+++ scribus/framelinkrouter.h	(working copy)
@@ -110,6 +110,9 @@
 	/// Indicate that the destination frame also sends an outgoing link (is mid-chain).
 	void setDestinationIsAlsoExit(bool b) { m_dstIsAlsoExit = b; }
 
+	/// Offset applied to selected frames while the canvas renders a live move preview.
+	void setSelectedItemsOffset(const FPoint& offset) { m_selectedItemsOffset = offset; }
+
 	/// Compute frame geometries, pick edges, and build the route waypoints.
 	void route();
 
@@ -126,6 +129,7 @@
 	PageItem* m_srcItem { nullptr };  ///< Source frame
 	PageItem* m_dstItem { nullptr };  ///< Destination frame
 	double m_scale {0.0};             ///< Canvas zoom factor
+	FPoint m_selectedItemsOffset;       ///< Temporary document-space translation for selected frames
 
 	/// True if source frame also receives a link (from prevInChain)
 	bool m_srcIsAlsoEntry = false;
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 27881)
+++ scribus/scribusview.cpp	(working copy)
@@ -2028,6 +2028,8 @@
 	m_doc->DragP = false;
 	m_doc->leaveDrag = false;
 	m_canvas->m_viewMode.operItemMoving = false;
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
 	MidButt = false;
 	HaveSelRect = false;
 	Magnify = false;
@@ -3703,6 +3705,8 @@
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->m_viewMode.operItemMoving = false;
 	m_canvas->m_viewMode.operItemResizing = false;
+	m_canvas->m_viewMode.liveMovePreview = false;
+	m_canvas->m_viewMode.movePreviewOffset = QPointF();
 	MidButt = false;
 }
 
PatchYes

Relationships

related to 0018100 new [patch] Add stroke alignment for closed frames and shapes 

Activities

buttar

2026-10-11 02:34

reporter   ~0054516

The description and patches have different prefixes: 'smi' and 'omi'. I forgot to edit the report after the rename. They are the same thing.

JLuc

2026-10-11 12:16

developer   ~0054517

Last edited: 2026-10-11 19:26

sorry buttar, I dont understand the difference and what you mean with « outline-only drag preview rather than live object movement »
... and watching your video doesnt help with it.
In the "proposed" video i see a snap to the center of the page but that doesnt seem related.

What does your patch proposes to improve ?

BTW i edited the patches prefix so they fit the uploaded files, as you mentionned in your comment.

buttar

2026-10-12 01:33

reporter   ~0054518

@JLuc thanks for the edit. Here is something that might help you see the difference:

-- when you move an object, currently, only its outline follows the pointer (and the object itself seems to stay at its original position) and when you let go of the click, the original object seems to jump from original to the new position. With the proposed, the object itself starts to move with the pointer -- live -- and when it stops when you let go, landing the new position.

-- secondly, I think the objects dont seem to page centre. But with proposed they do.

-- then the objects get a centre point (its tiny). The centre snaps to items and guides currently as well. However, the centre point gives objects a more polished look.

I hope I explained well. What do you think?

buttar

2026-10-12 01:36

reporter   ~0054519

CORRECTION: secondly, I think the objects dont seem SNAP* to page centre. But with proposed they do.

ale

2026-10-17 12:58

manager   ~0054536

Snapping to center of item (with center of item) should already be in Scribus.

Concerning the preview, I don't really care, but if it's not too expensive for the CPU, why not?

buttar

2026-11-17 00:22

reporter   ~0054757

Related to 0018094

Issue History

Date Modified Username Field Change
2026-10-10 10:05 buttar New Issue
2026-10-10 10:05 buttar Tag Attached: #please_test
2026-10-10 10:05 buttar File Added: object-movement-feedback-CURRENT.mp4
2026-10-10 10:05 buttar File Added: object-movement-feedback-PROPOSED.mp4
2026-10-10 10:05 buttar File Added: omi1-selection-center-marker-v1.02.patch
2026-10-10 10:05 buttar File Added: omi2-selection-movement-improvements-v1.06.patch
2026-10-10 10:05 buttar File Added: omi3-live-object-movement-v1.06.patch
2026-10-11 02:34 buttar Note Added: 0054516
2026-10-11 12:16 JLuc Note Added: 0054517
2026-10-11 19:24 JLuc Description Updated
2026-10-11 19:25 JLuc Note Edited: 0054517
2026-10-11 19:26 JLuc Note Edited: 0054517
2026-10-12 01:33 buttar Note Added: 0054518
2026-10-12 01:36 buttar Note Added: 0054519
2026-10-17 12:58 ale Note Added: 0054536
2026-10-17 20:02 cbradney Target Version => 1.8 Milestone
2026-10-29 17:09 cbradney Target Version 1.8 Milestone => 1.7.5.svn
2026-11-17 00:22 buttar Note Added: 0054757
2026-11-17 07:44 ale Relationship added related to 0018100