[TD]fix dim text wrong side of dim line (fix #16172)

This commit is contained in:
wandererfan
2024-08-31 19:37:13 -04:00
committed by Yorik van Havre
parent 9a5597a5fa
commit 93e685bd7a
2 changed files with 21 additions and 4 deletions

View File

@@ -768,6 +768,25 @@ double DrawViewDimension::getProjectedDimValue() const
}
pointPair DrawViewDimension::getLinearPoints() const
{
Base::Vector3d stdY{0, 1, 0};
if (Type.isValue("Distance")) {
// if the dimVec points the wrong way on generally vertical dims, the dim text will be
// placed on the wrong side of the dim line.
auto dimVec = m_linearPoints.second() - m_linearPoints.first();
dimVec.Normalize();
auto dotY = stdY.Dot(dimVec);
if (dotY > 0) {
// dimVec points up (ish) so the dim text will be to right of dim line and readable from
// left side of the page. Dimensions should always be readable from the bottom-right, so
// we flip the points.
return {m_linearPoints.second(), m_linearPoints.first()};
}
}
return m_linearPoints;
}
pointPair DrawViewDimension::getPointsOneEdge(ReferenceVector references)
{
// Base::Console().Message("DVD::getPointsOneEdge()\n");