Properly emulate old scrolling functionality #345
Conversation
The logic for the old step-wise scrolling functionality was improporly recreated in the new smooth-scrolling-based logic as of 189e195. This makes it *exactly* the same as it was before.
|
Bear in mind that the "Handle smooth scrolling events when devices send them" setting is one that requires MyPaint to be restarted. |
|
@iirelu You're seeing a lot of weirdness that I'm not. I'm wondering if your device is sending a mixed stream of smooth and non-smooth events for the same wheel rotation. Maybe that's just lingering worry from dealing with #344 though. Could you stick a few debug statements in there (on master) to rule that out please? diff --git a/gui/mode.py b/gui/mode.py
index 3f4149f..a26bc3e 100644
--- a/gui/mode.py
+++ b/gui/mode.py
@@ -470,6 +470,10 @@ class ScrollableModeMixin (InteractionMode):
# We don't rotate any more though. Srsly, that was awful.
if scroll_action == gui.device.ScrollAction.ZOOM:
if direction == gdk.SCROLL_SMOOTH:
+ logger.debug(
+ "PR#345: zoom-SMOOTH dx=%r,dy=%r",
+ event.delta_x, event.delta_y,
+ )
if constrain_smooth:
# Needs to work in an identical fashion to old-style
# zooming.
@@ -501,9 +505,11 @@ class ScrollableModeMixin (InteractionMode):
self.__reset_delta_totals()
# Old-style zooming
elif direction == gdk.SCROLL_UP:
+ logger.debug("PR#345: zoom-nonsmooth-INWARDS")
doc.zoom(doc.ZOOM_INWARDS)
self.__reset_delta_totals()
elif direction == gdk.SCROLL_DOWN:
+ logger.debug("PR#345: zoom-nonsmooth-OUTWARDS")
doc.zoom(doc.ZOOM_OUTWARDS)
self.__reset_delta_totals()And run with
There should be no interleaving of the "zoom-nonsmooth" and "zoom-SMOOTH" messages at any time, even when "Handle smooth scrolling events when devices send them" is set to "When devices send them" (and after MyPaint is restarted if you change it). If they interleave, we need to redo this bit of code pronto. I'd also like to see what the dx and dy values your device reports for the smooth flavour of events are. For this scrollwheel mouse here, it's ±1.0 exactly for each wheel notch. |
...Ah. Whoops. |
The logic for the old step-wise scrolling functionality was improporly recreated in the new smooth-scrolling-based logic as of 189e195. This makes it exactly the same as it was before.
I'm not familiar with this code so there might be some subtleties I'm missing that have to be accounted for, in which case just tell me and I'll fix it.
Right now it seems that this is only used if you untick the "Handle smooth scrolling events when devices send them" in your preferences, so I think there's still problems with the code not properly figuring out what's actually a smooth scrolling event.