[TD]fix dim text wrong side of dim line (fix #16172)
This commit is contained in:
committed by
Yorik van Havre
parent
9a5597a5fa
commit
93e685bd7a
@@ -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");
|
||||
|
||||
@@ -158,10 +158,8 @@ public:
|
||||
bool hasBroken3dReferences() const;
|
||||
|
||||
|
||||
virtual pointPair getLinearPoints() const
|
||||
{
|
||||
return m_linearPoints;
|
||||
}
|
||||
virtual pointPair getLinearPoints() const;
|
||||
|
||||
virtual void setLinearPoints(Base::Vector3d point0, Base::Vector3d point1)
|
||||
{
|
||||
m_linearPoints.first(point0);
|
||||
|
||||
Reference in New Issue
Block a user