From 241a217f5852be3f7c0dfcd4e7b48c7e000b3d6d Mon Sep 17 00:00:00 2001 From: Hugo Saint-Vignes Date: Thu, 4 Jun 2020 17:10:23 +0200 Subject: [PATCH] [apps/graph] Add fast scroll for regression and sequence graph views Change-Id: I6b36e929234ec5dc161b0eefb20eb84aa360fe3b --- apps/regression/graph_controller.cpp | 6 +++++- apps/sequence/graph/graph_controller.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 1bb6d9625..eceb6906a 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -235,7 +235,11 @@ bool GraphController::moveCursorHorizontally(int direction, bool fast) { } *m_selectedDotIndex = dotSelected; } else { - x = m_cursor->x() + direction * m_store->xGridUnit()/k_numberOfCursorStepsInGradUnit; + double step = direction * m_store->xGridUnit()/k_numberOfCursorStepsInGradUnit; + if (fast) { + step *= 5.0; + } + x = m_cursor->x() + step; y = yValue(*m_selectedSeriesIndex, x, globalContext()); } m_cursor->moveTo(x, x, y); diff --git a/apps/sequence/graph/graph_controller.cpp b/apps/sequence/graph/graph_controller.cpp index d35077101..cad4979f8 100644 --- a/apps/sequence/graph/graph_controller.cpp +++ b/apps/sequence/graph/graph_controller.cpp @@ -85,7 +85,7 @@ bool GraphController::moveCursorHorizontally(int direction, bool fast) { return false; } // The cursor moves by step that is larger than 1 and than a pixel's width. - const int step = std::ceil(m_view.pixelWidth()); + const int step = std::ceil(m_view.pixelWidth()) * (fast ? 5 : 1); double x = direction > 0 ? xCursorPosition + step: xCursorPosition - step; if (x < 0.0) {