Brief summary of issue / Description of requested feature:
Scrolling with mouse wheel or touchpad will always scroll by 3 lines each time that it is detected. Roll your whole hand across the wheel instantly doing 720 degrees of physical spin results in 3 lines of moving, whip all the way across the trackpad instantly and 3 lines, and so on. On the other hand slowly drag your fingers across the touchpad, you move 3, then another 3, then another 3 based on the polling interval. You can never go slow enough to move 1 or 2 lines. The function that it calls though includes a value saying how much the wheel moved, and Mudlet is only looking at whether that is positive or negative, says if you've moved it enough for the OS to tell us, then that's 3 lines.
Steps to reproduce the issue / Reasons for adding feature:
- Reproduce it by scrolling fast, slow, try to move by one or two lines
- Reason to update is to allow people to move by one or two lines, or to scroll longer distances quicker
Error output / Expected result of feature
Scrolling slow enough could scroll by one or two lines and be smoother and more accurate.
Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:
TTextEdit::wheelEvent at line 1707 is what handles it.
|
void TTextEdit::wheelEvent(QWheelEvent* e) |
|
{ |
|
int k = 3; |
|
if (e->delta() < 0) { |
|
mpConsole->scrollDown(abs(k)); |
|
e->accept(); |
|
return; |
|
} |
|
if (e->delta() > 0) { |
|
mpConsole->scrollUp(k); |
|
e->accept(); |
|
return; |
|
} |
|
e->ignore(); |
|
} |
Right now the logic is:
k = 3
if change is positive move up by k
if change is negative move down by k
New logic:
X is threshold amount of degrees that count as 1 line
Y is a cumulative tracking variable
if angle delta plus Y has absolute value of less than X, then update Y adding onto it and return
k = change / X
if k is positive move up by k lines
if k is negative move down by k lines
change Y to reflect that the move has been performed
https://doc.qt.io/qt-5/qwheelevent.html has details, sounds like 15 degrees might be a common minimum detected distance, and the delta is given in units that are 1/8 of a degree, so maybe X would be 120 (120 units * 1/8 = 15 degrees)
Brief summary of issue / Description of requested feature:
Scrolling with mouse wheel or touchpad will always scroll by 3 lines each time that it is detected. Roll your whole hand across the wheel instantly doing 720 degrees of physical spin results in 3 lines of moving, whip all the way across the trackpad instantly and 3 lines, and so on. On the other hand slowly drag your fingers across the touchpad, you move 3, then another 3, then another 3 based on the polling interval. You can never go slow enough to move 1 or 2 lines. The function that it calls though includes a value saying how much the wheel moved, and Mudlet is only looking at whether that is positive or negative, says if you've moved it enough for the OS to tell us, then that's 3 lines.
Steps to reproduce the issue / Reasons for adding feature:
Error output / Expected result of feature
Scrolling slow enough could scroll by one or two lines and be smoother and more accurate.
Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:
TTextEdit::wheelEvent at line 1707 is what handles it.
Mudlet/src/TTextEdit.cpp
Lines 1707 to 1721 in 2fd0bec
Right now the logic is:
k = 3
if change is positive move up by k
if change is negative move down by k
New logic:
X is threshold amount of degrees that count as 1 line
Y is a cumulative tracking variable
if angle delta plus Y has absolute value of less than X, then update Y adding onto it and return
k = change / X
if k is positive move up by k lines
if k is negative move down by k lines
change Y to reflect that the move has been performed
https://doc.qt.io/qt-5/qwheelevent.html has details, sounds like 15 degrees might be a common minimum detected distance, and the delta is given in units that are 1/8 of a degree, so maybe X would be 120 (120 units * 1/8 = 15 degrees)