r23321 by jghali - Improve drawing of item outlines when moving multiple items inside group
scribus-commit
scribus-commit at lists.scribus.net
Mon Nov 4 08:44:03 UTC 2019
Author: jghali
Date: Mon Nov 4 08:44:03 2019
New Revision: 23321
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23321
Log:
Improve drawing of item outlines when moving multiple items inside group
Modified:
trunk/Scribus/scribus/canvasmode.cpp
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23321&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Mon Nov 4 08:44:03 2019
@@ -638,11 +638,12 @@
if (docSelectionCount < m_canvas->moveWithBoxesOnlyThreshold)
{
PageItem *currItem;
-// p->translate(x, y);
- for (int a=0; a<docSelectionCount; ++a)
- {
- currItem = m_doc->m_Selection->itemAt(a);
- if (!m_doc->Items->contains(currItem))
+ for (int i = 0; i < docSelectionCount; ++i)
+ {
+ currItem = m_doc->m_Selection->itemAt(i);
+ if (!currItem->Parent && !m_doc->Items->contains(currItem))
+ continue;
+ if (currItem->Parent && !currItem->Parent->groupItemList.contains(currItem))
continue;
p->save();
if (docSelectionCount < m_canvas->moveWithFullOutlinesThreshold /*&& currItem->rotation() == 0*/)
@@ -686,36 +687,35 @@
}
#endif // GESTURE_FRAME_PREVIEW
{
+ QTransform itemTrans = currItem->getTransform(deltax, deltay);
+ double visualWidth = currItem->visualWidth();
+ double visualHeight = currItem->visualHeight();
+ double visualLineWidth = currItem->visualLineWidth();
+ double matRot = getRotationDFromMatrix(itemTrans);
+ double matScaleX, matScaleY;
+ getScaleFromMatrix(itemTrans, matScaleX, matScaleY);
+
p->save();
p->setBrush(m_brush["outline"]);
p->setPen(m_pen["outline"]);
- p->translate(currItem->xPos(), currItem->yPos());
- p->translate(deltax, deltay);
- if (currItem->rotation() != 0)
- {
+ p->setWorldTransform(itemTrans, true);
+ if (matRot != 0)
p->setRenderHint(QPainter::Antialiasing);
- p->rotate(currItem->rotation());
- }
+ p->scale(scalex /** matScaleX*/, scaley /** matScaleY*/);
if (currItem->isLine())
- p->translate(0, -currItem->visualLineWidth() / 2.0);
+ p->drawRect(QRectF(0.0, -visualLineWidth / 2.0, currItem->visualWidth(), currItem->visualHeight()));
else
- p->translate(-currItem->visualLineWidth() / 2.0, -currItem->visualLineWidth() / 2.0);
- p->scale(scalex, scaley);
- p->drawRect(QRectF(0.0, 0.0, currItem->visualWidth(), currItem->visualHeight()));
+ p->drawRect(QRectF(-visualLineWidth / 2.0, -visualLineWidth / 2.0, currItem->visualWidth(), currItem->visualHeight()));
p->restore();
+
p->save();
p->setBrush(m_brush["outline"]);
p->setPen(m_pen["outline"]);
- p->translate(currItem->xPos(), currItem->yPos());
- p->translate(deltax, deltay);
- if (currItem->rotation() != 0)
- {
+ p->setWorldTransform(itemTrans, true);
+ if (matRot != 0)
p->setRenderHint(QPainter::Antialiasing);
- p->rotate(currItem->rotation());
- }
- p->scale(scalex, scaley);
+ p->scale(scalex /** matScaleX*/, scaley /** matScaleY*/);
p->drawPath(currItem->PoLine.toQPainterPath(false));
- //currItem->DrawPolyL(p, currItem->Clip);
p->restore();
}
}
More information about the scribus-commit
mailing list