From d7bdb2c19a6816b881d1d844c984c33b72c14638 Mon Sep 17 00:00:00 2001 From: matthiasdanner Date: Mon, 2 Jun 2025 12:22:24 +0200 Subject: [PATCH] Sketcher: Fix Arrow Direction of Angle Arrows (#21645) * Fix Arrow Direction of Angle Arrows * Fix huge Space of angle box in negative angles * Swap the direction vectors for the arrows --- src/Gui/SoDatumLabel.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Gui/SoDatumLabel.cpp b/src/Gui/SoDatumLabel.cpp index be787055e7..d80be8fb71 100644 --- a/src/Gui/SoDatumLabel.cpp +++ b/src/Gui/SoDatumLabel.cpp @@ -1456,7 +1456,7 @@ void SoDatumLabel::drawAngle(const SbVec3f* points, float& angle, SbVec3f& textO SbVec3f v0(cos(startangle+range/2),sin(startangle+range/2),0); // leave some space for the text - double textMargin = std::min(0.2F*range, this->imgWidth/(2*r)); + double textMargin = std::min(0.2F * abs(range), this->imgWidth / (2 * r)); textOffset = p0 + v0 * r; @@ -1465,8 +1465,12 @@ void SoDatumLabel::drawAngle(const SbVec3f* points, float& angle, SbVec3f& textO glDrawArc(p0, r, startangle+range/2.+textMargin, endangle); // Direction vectors for start and end lines - SbVec3f v1(cos(startangle),sin(startangle),0); - SbVec3f v2(cos(endangle),sin(endangle),0); + SbVec3f v1(cos(startangle), sin(startangle), 0); + SbVec3f v2(cos(endangle), sin(endangle), 0); + + if (range < 0) { + std::swap(v1, v2); + } SbVec3f pnt1 = p0 + (r - endLineLength1) * v1; SbVec3f pnt2 = p0 + (r + endLineLength12) * v1; @@ -1487,7 +1491,6 @@ void SoDatumLabel::drawAngle(const SbVec3f* points, float& angle, SbVec3f& textO SbVec3f dirEnd(-v2[1], v2[0], 0); SbVec3f endArrowBase = p0 + r * v2; glDrawArrow(endArrowBase, dirEnd, arrowWidth, arrowLength); - } void SoDatumLabel::drawSymmetric(const SbVec3f* points)