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
This commit is contained in:
matthiasdanner
2025-06-02 12:22:24 +02:00
committed by GitHub
parent 79c93d4219
commit d7bdb2c19a

View File

@@ -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)