mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps/shared/curve_view] Fix label position rounding error
This commit is contained in:
committed by
EmilieNumworks
parent
702a222dbc
commit
95be59fdc6
@@ -269,7 +269,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
|
||||
|
||||
if (floatingLabels == FloatingPosition::None) {
|
||||
for (int i = minDrawnLabel; i < maxDrawnLabel; i++) {
|
||||
int labelPosition = minLabelPixelPosition + (((float)i)/((float)numberLabels-1)) * (maxLabelPixelPosition - minLabelPixelPosition);
|
||||
KDCoordinate labelPosition = std::round(floatToPixel(axis, labelValueAtIndex(axis, i)));
|
||||
KDRect graduation = axis == Axis::Horizontal ?
|
||||
KDRect(
|
||||
labelPosition,
|
||||
@@ -291,7 +291,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
|
||||
|
||||
// Draw the labels
|
||||
for (int i = minDrawnLabel; i < maxDrawnLabel; i++) {
|
||||
int labelPosition = minLabelPixelPosition + (((float)i)/((float)numberLabels-1)) * (maxLabelPixelPosition - minLabelPixelPosition);
|
||||
KDCoordinate labelPosition = std::round(floatToPixel(axis, labelValueAtIndex(axis, i)));
|
||||
char * labelI = label(axis, i);
|
||||
KDSize textSize = k_font->stringSize(labelI);
|
||||
float xPosition = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user