mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
[apps] Factorize scrolling speed for long repetition
Change-Id: I5fcfaf04e418942664641c4b1cd044cda7f5aebb
This commit is contained in:
committed by
Émilie Feral
parent
241a217f58
commit
b60c67ff88
@@ -79,13 +79,13 @@ bool GraphController::handleEnter() {
|
||||
return FunctionGraphController::handleEnter();
|
||||
}
|
||||
|
||||
bool GraphController::moveCursorHorizontally(int direction, bool fast) {
|
||||
bool GraphController::moveCursorHorizontally(int direction, int scrollSpeed) {
|
||||
double xCursorPosition = std::round(m_cursor->x());
|
||||
if (direction < 0 && xCursorPosition <= 0) {
|
||||
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()) * (fast ? 5 : 1);
|
||||
const int step = std::ceil(m_view.pixelWidth()) * scrollSpeed;
|
||||
double x = direction > 0 ? xCursorPosition + step:
|
||||
xCursorPosition - step;
|
||||
if (x < 0.0) {
|
||||
|
||||
Reference in New Issue
Block a user