diff --git a/ChangeLog.txt b/ChangeLog.txt index cd101c510..2caf16eae 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 2dd626320..feed82212 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -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()) diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 565193b4f..4c0fd8219 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -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;