View Issue Details

IDProjectCategoryView StatusLast Update
0017978ScribusUndo/Redopublic2026-09-12 17:59
Reporterbuttar Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Summary0017978: [patch] Node deletion Undo can move the edited object
Description- Undoing deletion of topmost or left-most nodes can restore the path at the wrong position.
- Right-most and bottom-most node deletions are generally unaffected.
Steps To Reproduce- Create a shape and enter Edit Shape mode.
- Delete a topmost or leftmost node(s).
- Press Ctrl+Z.
- The node returns, but the object changes position.
Additional Information# Fix
- Exclude automatic frame normalisation changes from the node-edit Undo transaction.
- Restore paths in the correct local coordinate space.
- Preserve item position, contour alignment and image offsets through Undo/Redo.
- Restore contour-only edits without recalculating frame geometry.
Tags#please_test
Attached Files
nodeedit-undo-position-restoration-v1.01.patch (2,693 bytes)   
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 27829)
+++ scribus/pageitem.cpp	(working copy)
@@ -8008,23 +8008,27 @@
 		double newX = istate->getDouble("NEW_X");
 		double newY = istate->getDouble("NEW_Y");
 
-		if (isUndo)
-		{
-			if (isContour)
-				ContourLine = oldClip;
-			else
-				PoLine = oldClip;
-			m_Doc->adjustItemSize(this);
-			m_Doc->moveItem(oldX - xPos(), oldY - yPos(), this);
-		}
+		const FPointArray& restoredPath = isUndo ? oldClip : newClip;
+		const double restoredX = isUndo ? oldX : newX;
+		const double restoredY = isUndo ? oldY : newY;
+
+		if (isContour)
+			ContourLine = restoredPath;
 		else
 		{
-			if (isContour)
-				ContourLine = newClip;
-			else
-				PoLine = newClip;
+			QTransform itemTransform = QTransform().rotate(-rotation());
+			QPointF pathDelta = itemTransform.map(QPointF(restoredX, restoredY))
+				- itemTransform.map(QPointF(xPos(), yPos()));
+			PoLine = restoredPath;
+			PoLine.translate(pathDelta.x(), pathDelta.y());
+
+			double xposOrig = xPos();
+			double yposOrig = yPos();
 			m_Doc->adjustItemSize(this);
-			m_Doc->moveItem(newX - xPos(), newY - yPos(), this);
+
+			QPointF contourDelta = itemTransform.map(QPointF(xposOrig, yposOrig))
+				- itemTransform.map(QPointF(xPos(), yPos()));
+			ContourLine.translate(contourDelta.x(), contourDelta.y());
 		}
 		if (oldClip.count() != newClip.count())
 			m_Doc->nodeEdit.deselect();
Index: scribus/canvasmode_nodeedit.cpp
===================================================================
--- scribus/canvasmode_nodeedit.cpp	(revision 27829)
+++ scribus/canvasmode_nodeedit.cpp	(working copy)
@@ -37,6 +37,7 @@
 #include "ui/nodeeditpalette.h"
 #include "ui/pageselector.h"
 #include "ui/scrspinbox.h"
+#include "undomanager.h"
 
 CanvasMode_NodeEdit::CanvasMode_NodeEdit(ScribusView* view) : CanvasMode(view)
 {
@@ -1527,7 +1528,16 @@
 		double yp = currItem->yPos();
 		double w = currItem->width();
 		double h = currItem->height();
+		const bool undoWasEnabled = UndoManager::undoEnabled();
+		if (undoWasEnabled)
+			UndoManager::instance()->setUndoEnabled(false);
 		m_doc->adjustItemSize(currItem, true);
+		if (undoWasEnabled)
+			UndoManager::instance()->setUndoEnabled(true);
+		QTransform itemTransform = QTransform().rotate(-currItem->rotation());
+		QPointF contourDelta = itemTransform.map(QPointF(xp, yp))
+			- itemTransform.map(QPointF(currItem->xPos(), currItem->yPos()));
+		currItem->ContourLine.translate(contourDelta.x(), contourDelta.y());
 		double xp2 = currItem->xPos();
 		double yp2 = currItem->yPos();
 		double w2 = currItem->width();
PatchYes

Activities

buttar

2026-09-12 17:59

reporter   ~0054460

Issue History

Date Modified Username Field Change
2026-09-12 17:57 buttar New Issue
2026-09-12 17:57 buttar Tag Attached: #please_test
2026-09-12 17:57 buttar File Added: nodeedit-undo-position-restoration-v1.01.patch
2026-09-12 17:59 buttar Note Added: 0054460
2026-09-12 17:59 buttar File Added: move-on-undo-issue.mp4