r23528 by jghali - #16071: Outline node movement changes contour, reset fails <Pontobart>
scribus-commit
scribus-commit at lists.scribus.net
Sun Mar 22 17:41:13 UTC 2020
Author: jghali
Date: Sun Mar 22 17:41:13 2020
New Revision: 23528
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23528
Log:
#16071: Outline node movement changes contour, reset fails <Pontobart>
Modified:
trunk/Scribus/scribus/canvasmode_nodeedit.cpp
trunk/Scribus/scribus/nodeeditcontext.cpp
trunk/Scribus/scribus/ui/nodeeditpalette.cpp
Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23528&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Sun Mar 22 17:41:13 2020
@@ -452,7 +452,12 @@
}
m_doc->adjustItemSize(currItem, true);
if (!m_doc->nodeEdit.isContourLine())
- currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
+ {
+ // Move the contour accordingly in the item's coordinate space
+ QTransform m = QTransform().rotate(-currItem->rotation());
+ QPointF delta = m.map(QPointF(xposOrig, yposOrig)) - m.map(QPointF(currItem->xPos(), currItem->yPos()));
+ currItem->ContourLine.translate(delta.x(), delta.y());
+ }
m_doc->regionsChanged()->update(QRectF());
if (state)
m_doc->nodeEdit.finishTransaction2(currItem, state);
Modified: trunk/Scribus/scribus/nodeeditcontext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23528&path=/trunk/Scribus/scribus/nodeeditcontext.cpp
==============================================================================
--- trunk/Scribus/scribus/nodeeditcontext.cpp (original)
+++ trunk/Scribus/scribus/nodeeditcontext.cpp Sun Mar 22 17:41:13 2020
@@ -352,7 +352,12 @@
currItem->Clip = flattenPath(currItem->PoLine, currItem->Segments);
}
if (!m_isContourLine)
- currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
+ {
+ // Move the contour accordingly in the item's coordinate space
+ QTransform m = QTransform().rotate(-currItem->rotation());
+ QPointF delta = m.map(QPointF(xposOrig, yposOrig)) - m.map(QPointF(currItem->xPos(), currItem->yPos()));
+ currItem->ContourLine.translate(delta.x(), delta.y());
+ }
}
Modified: trunk/Scribus/scribus/ui/nodeeditpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23528&path=/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.cpp Sun Mar 22 17:41:13 2020
@@ -971,9 +971,20 @@
EditCont->setChecked(false);
ToggleConMode();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
- currItem->setXYPos(xPos, yPos, true);
+
+ // Calculate the difference of the current position and the original
+ // position in the item's coordinate space (which is rotated and translated,
+ // but the translation does not matter for the delta)
+ QTransform m = QTransform().rotate(-currItem->rotation());
+ QPointF delta = m.map(QPointF(xPos, yPos)) - m.map(QPointF(currItem->xPos(), currItem->yPos()));
+ // During operation the image offsets and possibly other values are changed.
+ // To not remember everything we move the clip path to the original position
+ // relative to the current position (in the item's coordinate space).
+ // adjustItemSize will then take care of moving the position and changing
+ // image offsets, etc.
+ currItem->PoLine = itemPath.copy();
+ currItem->PoLine.translate(delta.x(), delta.y());
currItem->ContourLine = itemContourPath.copy();
- currItem->PoLine = itemPath.copy();
m_doc->adjustItemSize(currItem);
if (currItem->itemType() == PageItem::PathText)
currItem->updatePolyClip();
@@ -997,12 +1008,21 @@
m_doc->nodeEdit.selNode().clear();
m_doc->nodeEdit.setPreviewMode(false);
PageItem *currItem = m_doc->m_Selection->itemAt(0);
+
+ // See comment in NodePalette::CancelEdit
+ QTransform m = QTransform().rotate(-currItem->rotation());
+ QPointF delta = m.map(QPointF(xPos, yPos)) - m.map(QPointF(currItem->xPos(), currItem->yPos()));
if (EditCont->isChecked())
+ {
currItem->ContourLine = itemContourPath.copy();
+ currItem->ContourLine.translate(delta.x(), delta.y());
+ }
else
{
- currItem->setXYPos(xPos, yPos, true);
- currItem->PoLine = itemPath.copy();
+ // See comment in NodePalette::CancelEdit
+ currItem->PoLine = itemPath;
+ currItem->PoLine.translate(delta.x(), delta.y());
+ currItem->ContourLine = itemContourPath;
m_doc->adjustItemSize(currItem);
}
if (currItem->itemType() == PageItem::PathText)
More information about the scribus-commit
mailing list