-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance: make TConsole scrolling smoother #4445
Enhance: make TConsole scrolling smoother #4445
Conversation
Make it scroll by only 1 line of text per mouse wheel click instead of three lines. To compensate for the slower nature of the scrolling now, make the scrolling faster (to a half the number of lines in the upper `TTextEdit` pane per step instead of one line) when the control key is pressed during the wheel event; this thus mimics the same sort of speed up in the map zoom and scrolling through the selected room number/name listing in the 2D mapper. This should close Mudlet#4437 . It also fixes a potential bug in that the `TTextEdit::updateScreenView()` looked to be sending the "screenheight" for both the upper and lower panes to the same variable in the `Host` class - when they are not going to be the same value. It also removes the use of the obsolete `(int) QWheelEvent::delta()` in favour of the recommended `(QPoint) QWheelEvent::angleDelta()` in the `qlWidget` class. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
Pasted in Held fingertip at bottom of wheel range status quo: demo: Repeated that a few times, status quo shows a net gain of 10 lines or so. Managed to move 100 lines up just wiggling finger back and forth between same 2 spots at different speeds a few times. With new build, moving back and forth between 2 spots brings it back and forth between the same 2 spots. Moving faster just gets you there faster. Scrolling to an exact line is much easier now. Very nice. From the bottom, scroll up to line 500. status quo: 33 rolls up (at comfortable speed) So it's more exact, but feels pretty different, slower if you're wanting to go back far and not aware of the control key thing. Adjusting multiplier would be judgement call for testing. Tried two fingers on the touchpad of my laptop... status quo: demo: |
I would have an outside variable something vaguely like this, which would be held in-between the events and range from -119 to 119 saying how much wheel movement happened so far but didn't result in scrolling any lines:
Then if you move your device by for example 90 points four times in a row then you'll move by 3 lines rather than 0: |
I haven't looked at touch pad considerations in this - but IIRC the Qt documentation does make mention of some hi-resolution devices not behaving the same as a clicky mouse scroll wheel, lemme see if I can find it... Ah yeah, it is in the obvious place as part of the
void MyWidget::wheelEvent(QWheelEvent *event)
{
QPoint numPixels = event->pixelDelta();
QPoint numDegrees = event->angleDelta() / 8;
if (!numPixels.isNull()) {
scrollWithPixels(numPixels);
} else if (!numDegrees.isNull()) {
QPoint numSteps = numDegrees / 15;
scrollWithDegrees(numSteps);
}
event->accept();
}
I am going to have to look at this again and see what I can do after a good thunk... |
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Bring in recent upstream changes. Signed-off by: Stephen Lyons <slysven@virginmedia.com>
Tried it out in same way as before using trackpad on Logitech k400r, dragged super slow and made progress as intended. I didn't look too close at the code but feels much better and can easily scroll to exact line. I do notice that it can not scroll horizontal. But the release build doesn't scroll horizonal either like it did with #4085. The oldest one on the snapshots page doesn't scroll horizontal either. That got broken at some point more than 14 days ago, but more recent than the last build in my download folder, Mudlet-4.9.1-testing-pr3992-fd96e822-windows from Oct 23. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels good!
src/TTextEdit.cpp
Outdated
e->ignore(); | ||
// Make the speed up be half of the (upper pane) lines - need to round it so | ||
// that a decimal part does not make the end +/- value for up/down different | ||
// in magitude: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// in magitude: | |
// in magnitude: |
src/TTextEdit.cpp
Outdated
// Store the (rounded) remainder | ||
mMouseWheelRemainder = QPoint(delta.x() - (15 * xDelta), delta.y() - (15 * yDelta)); | ||
|
||
qDebug().noquote().nospace() << "TTextEdit::wheelEvent(...) INFO - in \"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W.I.P. on the horizontal scrolling aspect at the moment and I am using that. Mayhaps I should move that to a separate PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, another PR is good
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Thanks for working on this 👍 |
I think that this was the last instance of delta() to switch over to angleDelta() and this closes #498. |
Make it scroll by only 1 line of text per mouse wheel click instead of three lines. To compensate for the slower nature of the scrolling now, make the scrolling faster (to a half the number of lines in the upper `TTextEdit` pane per step instead of one line) when the control key is pressed during the wheel event; this thus mimics the same sort of speed up in the map zoom and scrolling through the selected room number/name listing in the 2D mapper. This should close Mudlet#4437 . It also fixes a potential bug in that the `TTextEdit::updateScreenView()` looked to be sending the "screenheight" for both the upper and lower panes to the same variable in the `Host` class - when they are not going to be the same value. It also removes the use of the obsolete `(int) QWheelEvent::delta()` in favour of the recommended `(QPoint) QWheelEvent::angleDelta()` in the `qlWidget` class. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Make it scroll by only 1 line of text per mouse wheel click instead of three lines. To compensate for the slower nature of the scrolling now, make the scrolling faster (to a half the number of lines in the upper
TTextEdit
pane per step instead of one line) when the control key is pressed during the wheel event; this thus mimics the same sort of speed up in the map zoom and scrolling through the selected room number/name listing in the 2D mapper.This should close #4437 .
It also fixes a potential bug in that the
TTextEdit::updateScreenView()
looked to be sending the "screenheight" for both the upper and lower panes to the same variable in theHost
class - when they are not going to be the same value.It also removes the use of the obsolete
(int) QWheelEvent::delta()
in favour of the recommended(QPoint) QWheelEvent::angleDelta()
in theqlWidget
class.Signed-off-by: Stephen Lyons slysven@virginmedia.com