mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/regression] Improve vertical navigation
Data set: X1 2 3 2 1 Y1 0 1 0.5 5 X2 1 10 2 Y2 0 25 0.5 There was circular navigation on series 2 mean point
This commit is contained in:
committed by
EmilieNumworks
parent
99d97ecb45
commit
42cdf95e9f
@@ -315,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;
|
||||
|
||||
@@ -63,7 +63,8 @@ int Store::closestVerticalDot(int direction, double x, double y, int currentSeri
|
||||
&& (std::fabs(currentX - x) <= std::fabs(nextX - x)) // The next dot is the closest to x in abscissa
|
||||
&& ((currentY > y && direction > 0) // The next dot is above/under y
|
||||
|| (currentY < y && direction < 0)
|
||||
|| (currentY == y && (currentDot < 0 || ((direction < 0) == (series > currentSeries)))))
|
||||
|| (currentY == y
|
||||
&& ((currentDot < 0 && direction > 0)|| ((direction < 0) == (series > currentSeries)))))
|
||||
&& (nextX != currentX // Edge case: if 2 dots have the same abscissa but different ordinates
|
||||
|| ((currentY <= nextY) == (direction > 0))))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user