summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Varanka <sami.varanka@qt.io>2021-06-10 12:45:14 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-11 11:26:24 +0000
commita94f9816a9bae2baea38681096a209bf3839a883 (patch)
treee00ae0b0f2160d96632c0a01d30229d0396e6d07
parent473e19398649a32b36ead33bb086f38b33edfc08 (diff)
Fix bargraph labels face wrong direction
When the camera's X rotation is 180.0f, the labels were rotated to face wrong direction. The axis title labels do not respect the Abstract3DAxis's titleFixed property. Created a new bugreport QTBUG-94441. Fixes: QTBUG-90371 Change-Id: I80115b8b363a7385dfd2cb1f004a05368549ed48 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> (cherry picked from commit d2543d8bbd27e9dd13698f457845adb0f5a6d428) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index 329f5666..6107e7a1 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -2051,10 +2051,14 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer
glEnable(GL_POLYGON_OFFSET_FILL);
+ // If camera x rotation is 180, side labels face wrong direction
+ float activeCameraXRotation = (activeCamera->xRotation() >= 180.0f) ? -180.0f
+ : activeCamera->xRotation();
+
float labelAutoAngle = m_axisCacheY.labelAutoRotation();
float labelAngleFraction = labelAutoAngle / 90.0f;
float fractionCamY = activeCamera->yRotation() * labelAngleFraction;
- float fractionCamX = activeCamera->xRotation() * labelAngleFraction;
+ float fractionCamX = activeCameraXRotation * labelAngleFraction;
float labelsMaxWidth = 0.0f;
int startIndex;
@@ -2168,7 +2172,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer
labelAutoAngle = m_axisCacheZ.labelAutoRotation();
labelAngleFraction = labelAutoAngle / 90.0f;
fractionCamY = activeCamera->yRotation() * labelAngleFraction;
- fractionCamX = activeCamera->xRotation() * labelAngleFraction;
+ fractionCamX = activeCameraXRotation * labelAngleFraction;
GLfloat labelYAdjustment = 0.005f;
GLfloat colPosValue = m_scaleXWithBackground + labelMargin;
GLfloat rowPosValue = m_scaleZWithBackground + labelMargin;
@@ -2293,7 +2297,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer
labelAutoAngle = m_axisCacheX.labelAutoRotation();
labelAngleFraction = labelAutoAngle / 90.0f;
fractionCamY = activeCamera->yRotation() * labelAngleFraction;
- fractionCamX = activeCamera->xRotation() * labelAngleFraction;
+ fractionCamX = activeCameraXRotation * labelAngleFraction;
alignment = (m_xFlipped != m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
if (labelAutoAngle == 0.0f) {
labelRotation = QVector3D(-90.0f, 90.0f, 0.0f);