Repository: vispy/vispy

Issue:
Expose totalRotationAngle and totalScaleFactor in touch event ?
In [here](https://github.com/vispy/vispy/blob/7f3f6f60c8462bb8a3a8fa03344a2e6990b86eb2/vispy/app/backends/_qt.py#L509-L536), would it be ok to also expose the two above attributes; as well as maybe a reference to the native event (weak ref if you are concerned).

`total*` contain the value since the begin touch event; we cna of course accumulating the current delta when pinching/rotating but this accumulate error; and can be error prone as you also have to catch the begin and end events as well.

There might be reasons not to do that (have the same event struct across backend?) but I haven't found other code triggering `.touch()` events. And in that case I thin that a private fields `_native` that contain the raw even could be sufficient.

Note that there is also totalChangeFlags I believe; but I do not have any thoughts on this one, though I guess it makes sens.

Thanks.


Discussion:
I'm open to adding any extra properties that might make sense. I'm a little confused by the code though as I don't see a TouchEvent class anywhere in vispy except for a mention in a comment. Does this existing event handling work at all?
Yes it does; they do register as simply `Event` though, and `self.canvas.connect(self.on_touch)` works. 
(took me 2h yesterday to figure that out, but I figured it !)

There might be a short "MouseWheel" event sometime just before the touch even as two finger on touchpad is used for both on mac.

My guess is there is not a lot of user of this (as mostly it work on mac touchpad), and the original author was not sure about the final structure of a potential "TouchEvent" so left it as is.

I also tried to subclass `Canvas` and overwrite `def event(self, ev):` but that did not work I'm not sure why...
If you can make a pull request for the additional properties on the Event, I'm ok with that. I'm a little hesitant on the `_native` idea, but if you **really** need it then I can be convinced.
I don't think I _really_ need `_native`; I just saw it on MouseWheel; so though it was an escape hatch that was put there on purpose.

Thanks, I'll likely make a PR, but probably not this week.

Resolving patch:
diff --git a/vispy/app/backends/_qt.py b/vispy/app/backends/_qt.py
--- a/vispy/app/backends/_qt.py
+++ b/vispy/app/backends/_qt.py
@@ -517,13 +517,16 @@ def event(self, ev):
                 scale = gesture.scaleFactor()
                 last_scale = gesture.lastScaleFactor()
                 rotation = gesture.rotationAngle()
-                self._vispy_canvas.events.touch(type='pinch',
-                                                pos=(x, y),
-                                                last_pos=None,
-                                                scale=scale,
-                                                last_scale=last_scale,
-                                                rotation=rotation,
-                                                )
+                self._vispy_canvas.events.touch(
+                    type="pinch",
+                    pos=(x, y),
+                    last_pos=None,
+                    scale=scale,
+                    last_scale=last_scale,
+                    rotation=rotation,
+                    total_rotation_angle=gesture.totalRotationAngle(),
+                    total_scale_factor=gesture.totalScaleFactor(),
+                )
         # General touch event.
         elif (t == QtCore.QEvent.TouchUpdate):
             points = ev.touchPoints()


Test patch: