mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[apps/graph/graph] Modify the law model method panToMakePointVisible to return a
boolean Change-Id: Ib61a7c96d3716cc25e03b056c1ed3864db82f60d
This commit is contained in:
@@ -212,7 +212,8 @@ void GraphWindow::setDefault() {
|
||||
setYAuto(true);
|
||||
}
|
||||
|
||||
void GraphWindow::panToMakePointVisible(float x, float y, float xMargin, float yMargin) {
|
||||
bool GraphWindow::panToMakePointVisible(float x, float y, float xMargin, float yMargin) {
|
||||
bool windowMoved = false;
|
||||
float xRange = m_xMax - m_xMin;
|
||||
float yRange = m_yMax - m_yMin;
|
||||
if (x < m_xMin + xMargin) {
|
||||
@@ -220,23 +221,28 @@ void GraphWindow::panToMakePointVisible(float x, float y, float xMargin, float y
|
||||
m_xMax = m_xMin + xRange;
|
||||
computeGridUnit(Axis::X);
|
||||
computeYaxes();
|
||||
windowMoved = true;
|
||||
}
|
||||
if (x > m_xMax - xMargin) {
|
||||
m_xMax = x + xMargin;
|
||||
m_xMin = m_xMax - xRange;
|
||||
computeGridUnit(Axis::X);
|
||||
computeYaxes();
|
||||
windowMoved = true;
|
||||
}
|
||||
if (y < m_yMin + yMargin) {
|
||||
m_yMin = y - yMargin;
|
||||
m_yMax = m_yMin + yRange;
|
||||
computeGridUnit(Axis::Y);
|
||||
windowMoved = true;
|
||||
}
|
||||
if (y > m_yMax - yMargin) {
|
||||
m_yMax = y + yMargin;
|
||||
m_yMin = m_yMax - yRange;
|
||||
computeGridUnit(Axis::Y);
|
||||
windowMoved = true;
|
||||
}
|
||||
return windowMoved;
|
||||
}
|
||||
|
||||
void GraphWindow::computeGridUnit(Axis axis) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
void roundAbscissa();
|
||||
void normalize();
|
||||
void setDefault();
|
||||
void panToMakePointVisible(float x, float y, float xMargin, float yMargin);
|
||||
bool panToMakePointVisible(float x, float y, float xMargin, float yMargin);
|
||||
private:
|
||||
constexpr static float k_minNumberOfXGridUnits = 7.0f;
|
||||
constexpr static float k_maxNumberOfXGridUnits = 18.0f;
|
||||
|
||||
Reference in New Issue
Block a user