Files
Upsilon/apps/shared/curve_view_cursor.cpp
Émilie Feral e6e31adee7 [apps/shared] In graph, enable cursor to be at infinity without moving range
Change-Id: I6de1593a3017d28c0187a0a3ab3f19b7cbbaa667
2017-04-07 16:22:41 +02:00

32 lines
496 B
C++

#include "curve_view_cursor.h"
#include <math.h>
namespace Shared {
CurveViewCursor::CurveViewCursor() :
m_x(NAN),
m_y(NAN)
{
}
float CurveViewCursor::x() {
return m_x;
}
float CurveViewCursor::y() {
return m_y;
}
void CurveViewCursor::moveTo(float x, float y) {
m_x = clipped(x);
m_y = clipped(y);
}
float CurveViewCursor::clipped(float x) {
float clippedX = x > k_maxFloat ? INFINITY : x;
clippedX = clippedX < - k_maxFloat ? -INFINITY : clippedX;
return clippedX;
}
}