Extend piece bounding rect. Closes #122

This commit is contained in:
Roman Telezhynskyi 2021-04-23 09:26:49 +03:00
parent 1cccaf097c
commit d9f2b756a4
3 changed files with 9 additions and 9 deletions

View File

@ -4,6 +4,7 @@
- [smart-pattern/valentina#120] Incorrect seam allowance.
- Fix export to DXF AAMA/ASTM.
- [smart-pattern/valentina#121] Incorrect elliptical arc end angle.
- [smart-pattern/valentina#122] Extend piece bounding rect.
# Version 0.7.46 Mar 31, 2021
- Fix incorrect calculation of value for multisize measurements in Valentina.

View File

@ -932,14 +932,12 @@ void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem
//---------------------------------------------------------------------------------------------------------------------
QRectF VToolSeamAllowance::boundingRect() const
{
if (m_mainPathRect.isNull())
if (m_pieceBoundingRect.isNull())
{
return QGraphicsPathItem::boundingRect();
}
else
{
return m_mainPathRect;
}
return m_pieceBoundingRect;
}
//---------------------------------------------------------------------------------------------------------------------
@ -1270,7 +1268,6 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat
: VInteractiveTool(initData.doc, initData.data, initData.id),
QGraphicsPathItem(parent),
m_mainPath(),
m_mainPathRect(),
m_sceneDetails(initData.scene),
m_drawName(initData.drawName),
m_seamAllowance(new VNoBrushScalePathItem(this)),
@ -1366,7 +1363,6 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|| not detail.IsSeamAllowance() || detail.IsSeamAllowanceBuiltIn())
{
m_mainPath = QPainterPath();
m_mainPathRect = QRectF();
m_seamAllowance->setBrush(QBrush(Qt::Dense7Pattern));
path = futurePath.result();
}
@ -1375,7 +1371,6 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
m_seamAllowance->setBrush(QBrush(Qt::NoBrush)); // Disable if the main path was hidden
// need for returning a bounding rect when main path is not visible
m_mainPath = futurePath.result();
m_mainPathRect = m_mainPath.controlPointRect();
path = QPainterPath();
}
@ -1395,10 +1390,14 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result()));
path.setFillRule(Qt::OddEvenFill);
m_seamAllowance->setPath(path);
m_pieceBoundingRect = m_seamAllowance->path().controlPointRect();
}
else
{
m_seamAllowance->setPath(QPainterPath());
m_pieceBoundingRect = m_mainPath.controlPointRect();
}
if (VAbstractApplication::VApp()->IsAppInGUIMode())

View File

@ -176,7 +176,7 @@ private:
Q_DISABLE_COPY(VToolSeamAllowance)
QPainterPath m_mainPath; // Must be first to prevent crash
QRectF m_mainPathRect;
QRectF m_pieceBoundingRect{};
/** @brief sceneDetails pointer to the scene. */
VMainGraphicsScene *m_sceneDetails;