From 0600f36b10bc4482495c3ff47ebb94cdad7f2d53 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 21 Jul 2024 09:38:12 -0400 Subject: [PATCH] [TD]fix leader start point on rotated view --- src/Mod/TechDraw/Gui/TaskLeaderLine.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp index c340dc0958..f464d00dac 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp @@ -339,7 +339,6 @@ void TaskLeaderLine::onLineStyleChanged() //! sceneDeltas are in Qt scene coords (Rez and inverted Y). void TaskLeaderLine::createLeaderFeature(std::vector sceneDeltas) { - // Base::Console().Message("TTL::createLeaderFeature()\n"); const std::string objectName{"LeaderLine"}; std::string m_leaderName = m_basePage->getDocument()->getUniqueObjectName(objectName.c_str()); m_leaderType = "TechDraw::DrawLeaderLine"; @@ -354,9 +353,12 @@ void TaskLeaderLine::createLeaderFeature(std::vector sceneDeltas Command::doCommand(Command::Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)", PageName.c_str(), m_leaderName.c_str()); + + double baseRotation{0}; if (m_baseFeat) { Command::doCommand(Command::Doc, "App.activeDocument().%s.LeaderParent = App.activeDocument().%s", m_leaderName.c_str(), m_baseFeat->getNameInDocument()); + baseRotation = m_baseFeat->Rotation.getValue(); } App::DocumentObject* obj = m_basePage->getDocument()->getObject(m_leaderName.c_str()); @@ -366,6 +368,13 @@ void TaskLeaderLine::createLeaderFeature(std::vector sceneDeltas if (obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { m_lineFeat = static_cast(obj); + auto forMath{m_attachPoint}; + if (baseRotation != 0) { + forMath = DU::invertY(forMath); + forMath.RotateZ(-Base::toRadians(baseRotation)); + forMath = DU::invertY(forMath); + } + m_attachPoint = forMath; m_lineFeat->setPosition(Rez::appX(m_attachPoint.x), Rez::appX(- m_attachPoint.y), true); if (!sceneDeltas.empty()) { std::vector pageDeltas; @@ -378,7 +387,6 @@ void TaskLeaderLine::createLeaderFeature(std::vector sceneDeltas // should just do this in place. if (m_lineFeat->AutoHorizontal.getValue()) { pageDeltas = DrawLeaderLine::horizLastSegment(pageDeltas); - // m_lineFeat->horizLastSegment(); } // convert to unscaled, unrotated but inverted auto temp = m_lineFeat->makeCanonicalPointsInverted(pageDeltas);