From c6e54f90c3f2ec8cecdfa473cdf42b44cbda173a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 8 Jan 2020 17:18:47 +0100 Subject: [PATCH] [apps/shared] CurveView: fix confusion between after/before relative position in drawLabel --- .../additional_outputs/trigonometry_graph_cell.cpp | 2 +- apps/shared/curve_view.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp b/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp index ce5985187..6d2f808c1 100644 --- a/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp +++ b/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp @@ -31,7 +31,7 @@ void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const { drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, true); // Draw labels drawLabel(ctx, rect, 0.0f, s, "sin(θ)", Palette::Red, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None); - drawLabel(ctx, rect, c, 0.0f, "cos(θ)", Palette::Red, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::Before); + drawLabel(ctx, rect, c, 0.0f, "cos(θ)", Palette::Red, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After); } } diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 993b6e9f1..d63246c5a 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -236,10 +236,10 @@ KDPoint CurveView::positionLabel(KDCoordinate xPosition, KDCoordinate yPosition, xPosition -= labelSize.width()/2; } switch (verticalPosition) { - case RelativePosition::Before: // Above + case RelativePosition::After: // Above yPosition -= labelSize.height() + k_labelMargin; break; - case RelativePosition::After: // Below + case RelativePosition::Before: // Below yPosition += k_labelMargin; break; default: @@ -358,11 +358,11 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis continue; } if (shiftOrigin && floatingLabels == FloatingPosition::None) { - position = positionLabel(horizontalCoordinate, verticalCoordinate, textSize, RelativePosition::Before, RelativePosition::After); + position = positionLabel(horizontalCoordinate, verticalCoordinate, textSize, RelativePosition::Before, RelativePosition::Before); } } else { if (axis == Axis::Horizontal) { - position = positionLabel(labelPosition, verticalCoordinate, textSize, RelativePosition::None, RelativePosition::After); + position = positionLabel(labelPosition, verticalCoordinate, textSize, RelativePosition::None, RelativePosition::Before); if (floatingLabels == FloatingPosition::Min) { position = KDPoint(position.x(), k_labelMargin); } else if (floatingLabels == FloatingPosition::Max) {