[apps/regression] More intuitive curve/dot vertical navigation

This commit is contained in:
Léa Saviot
2018-12-12 10:44:37 +01:00
committed by EmilieNumworks
parent 96c6143c6e
commit 460c21801f
2 changed files with 22 additions and 45 deletions

View File

@@ -291,8 +291,7 @@ bool GraphController::moveCursorVertically(int direction) {
// Find the closest dot
int closestDotSeries = -1;
double selectedDotY = *m_selectedDotIndex == -1 ? (direction > 0 ? -DBL_MAX : DBL_MAX) : y;
int dotSelected = m_store->closestVerticalDot(direction, x, selectedDotY, *m_selectedSeriesIndex, *m_selectedDotIndex, &closestDotSeries, context);
int dotSelected = m_store->closestVerticalDot(direction, x, y, *m_selectedSeriesIndex, *m_selectedDotIndex, &closestDotSeries, context);
// Choose between selecting the regression or the dot
bool validRegression = closestRegressionSeries > -1;
@@ -316,7 +315,7 @@ bool GraphController::moveCursorVertically(int direction) {
double dotDistanceY = (dotSelected == m_store->numberOfPairsOfSeries(closestDotSeries)) ?
std::fabs(m_store->meanOfColumn(closestDotSeries, 1) - y) :
std::fabs(m_store->get(closestDotSeries, 1, dotSelected) - y);
if (regressionDistanceY <= dotDistanceY) {
if (regressionDistanceY < dotDistanceY) {
validDot = false;
} else {
validRegression = false;