From ee705768e981dd4f87b2008a1adf43aea11e4b33 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 13 May 2024 19:34:11 +0300 Subject: [PATCH] Fix updating notches. --- src/libs/vtools/tools/vtoolseamallowance.cpp | 48 ++++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 295e93d07..3512b54a5 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -270,35 +270,35 @@ auto RenderSeamAllowancePath(const VPiece &detail, bool combineTogether, const V //--------------------------------------------------------------------------------------------------------------------- auto RenderPassmarks(const VPiece &detail, const VContainer *data) -> QPainterPath { - const QLineF mirrorLine = detail.SeamMirrorLine(data); - if (!mirrorLine.isNull() && detail.IsShowFullPiece()) + if (const QLineF mirrorLine = detail.SeamMirrorLine(data); !mirrorLine.isNull() && detail.IsShowFullPiece()) { - QPainterPath path; - - if (detail.IsSeamAllowance()) + if (!detail.IsSeamAllowance()) { - const QTransform matrix = VGObject::FlippingMatrix(mirrorLine); - const QVector passmarks = VLayoutPiece::ConvertPassmarks(detail, data); - for (const auto &passmark : passmarks) + return {}; + } + + QPainterPath path; + const QTransform matrix = VGObject::FlippingMatrix(mirrorLine); + const QVector passmarks = VLayoutPiece::ConvertPassmarks(detail, data); + for (const auto &passmark : passmarks) + { + QPainterPath passmaksPath; + for (const auto &line : passmark.lines) { - QPainterPath passmaksPath; + passmaksPath.moveTo(line.p1()); + passmaksPath.lineTo(line.p2()); + } + path.addPath(passmaksPath); + + if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2())) + { + QPainterPath mirroredPassmaksPath; for (const auto &line : passmark.lines) { - passmaksPath.moveTo(line.p1()); - passmaksPath.lineTo(line.p2()); - } - path.addPath(passmaksPath); - - if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2())) - { - QPainterPath mirroredPassmaksPath; - for (const auto &line : passmark.lines) - { - mirroredPassmaksPath.moveTo(line.p1()); - mirroredPassmaksPath.lineTo(line.p2()); - } - path.addPath(matrix.map(mirroredPassmaksPath)); + mirroredPassmaksPath.moveTo(line.p1()); + mirroredPassmaksPath.lineTo(line.p2()); } + path.addPath(matrix.map(mirroredPassmaksPath)); } } @@ -1093,7 +1093,7 @@ void VToolSeamAllowance::UpdatePatternInfo() void VToolSeamAllowance::UpdatePassmarks() { const VPiece detail = VAbstractTool::data.GetPiece(m_id); - m_passmarks->setPath(detail.PassmarksPath(getData())); + m_passmarks->setPath(RenderPassmarks(detail, getData())); } //---------------------------------------------------------------------------------------------------------------------