mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] CurveView: fix confusion between after/before relative
position in drawLabel
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user