summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Zotti <Georg.Zotti@univie.ac.at>2023-02-14 20:47:05 +0100
committerGeorg Zotti <Georg.Zotti@univie.ac.at>2023-02-14 20:47:05 +0100
commitaca63a91ff4aff2ed9866364f8a4cc22f47a2168 (patch)
tree2ce8c7cb771bf46dac918a4ba490694aaf55776e
parent2437c915795fad0775e9caf2600dab3953098609 (diff)
tweak minimum angle at top edgefix/edge-callback-labels
-also remove second approach
-rw-r--r--src/core/modules/GridLinesMgr.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/core/modules/GridLinesMgr.cpp b/src/core/modules/GridLinesMgr.cpp
index 8d612e027e..7a49383671 100644
--- a/src/core/modules/GridLinesMgr.cpp
+++ b/src/core/modules/GridLinesMgr.cpp
@@ -374,38 +374,27 @@ void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& directio
// QString::number(viewportWidth), QString::number(viewportHeight)));
// Tweak edges with two ideas:
// xshift is a left-right-shift after text rotation, i.e. along text direction --> SEEMS ENOUGH!
- // edgeOffset is a more radical change in string placement. Test here to see what the better solution is.
- Vec2f edgeOffset(0.f);
if ((fabs(screenPos[0])<1.) && (angleDeg>0.f )) // LEFT
{
//text.append(" - LeftEdge"); // DEBUG ONLY!
xshift+=0.5f*tan(angleDeg*M_PI_180f)*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[0]=qMin(0.5f, tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[1]=qMin(2.0f, tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height(); // 5?
- //text.append(edgeOffset.toString());
}
else if ((fabs(screenPos[0]-viewportWidth)<1.) && (angleDeg>180.f )) // RIGHT
{
//text.append("-RightEdge"); // DEBUG ONLY!
//xshift*=(1.+1.f/tan(angleDeg*M_PI_180f));
xshift += 0.5 * tan(angleDeg*M_PI_180f)*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[0]=qMin(0.5f, tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[1]=qMin(2.0f, -tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height(); // 5?
- //text.append(edgeOffset.toString());
}
- else if ((fabs(screenPos[1]-viewportHeight)<1.)) // TOP
+ else if ((fabs(screenPos[1]-viewportHeight)<1.) && fabs(angleDeg)>5.f) // TOP
{
const float sign = angleDeg<-90.f ? 0.5f : -0.5f;
//text.append(" - TopEdge"); // DEBUG ONLY!
//xshift*=(1.+1.f/tan(angleDeg*M_PI_180f));
xshift += sign * (1./tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[0]=qMin(0.5f, tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height();
- //edgeOffset[1]=qMin(2.0f, -tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height(); // 5?
- //text.append(edgeOffset.toString());
}
// It seems bottom edge is always OK!
- d->sPainter->drawText(static_cast<float>(screenPos[0])+edgeOffset[0], static_cast<float>(screenPos[1])+edgeOffset[1], text, angleDeg, xshift*ppx, yshift*ppx);
+ d->sPainter->drawText(static_cast<float>(screenPos[0]), static_cast<float>(screenPos[1]), text, angleDeg, xshift*ppx, yshift*ppx);
d->sPainter->setColor(tmpColor);
//d->sPainter->setBlending(true); // This should have been true on entry, and we don't change it, why set it here?
}