Add pinch-to-zoom, improve zooming on trackpads and smooth scroll wheels#799
Conversation
cameronwhite
left a comment
There was a problem hiding this comment.
Thanks for working on this!
This works very well in my testing on a Macbook - I just left a few questions and style comments.
# Conflicts: # Pinta.Gui.Widgets/Widgets/Canvas/CanvasWindow.cs
| var scroll_controller = Gtk.EventControllerScroll.New (EventControllerScrollFlags.Vertical); | ||
| var scroll_controller = Gtk.EventControllerScroll.New (EventControllerScrollFlags.BothAxes); | ||
| scroll_controller.OnScroll += HandleScrollEvent; | ||
| scroll_controller.OnDecelerate += (_, _) => gesture_zoom.IsActive (); |
There was a problem hiding this comment.
There are some Dereference of a possibly null reference warnings here, maybe because gesture_zoom is initialized below?
I'm not quite clear what this event handler is doing, along with the BothAxes flag added above? Otherwise I think all the changes are looking good now 👍
There was a problem hiding this comment.
Warning's fixed. BothAxes makes sure that both horizontal and vertical scrolling will be cancelled while the user is using the zoom gesture (the first check under HandleScrollEvent). The OnDecelerate handler returns true when the zoom gesture is being used to cancel the scroll deceleration as well. Together, they stop janky behavior where scrolling and zooming are detected at the same time.
|
Looks good, thanks! |
Fixes #634 and #715