enthought / chaco

Chaco is a Python package for building interactive and custom 2-D plots.
http://docs.enthought.com/chaco/
Other
292 stars 99 forks source link

Enable multi-touch for zooming Chaco plots #396

Open achabotl opened 6 years ago

achabotl commented 6 years ago

Would it be hard to enable multi-touch for zooming and panning Chaco plots? They currently "automatically" support panning when using a single finger, but not zooming using two fingers. I made a short video to show the interaction: https://youtu.be/RfbxfvMPICw

It's on a tablet running Windows 10.

rkern commented 6 years ago

Not hard, per se. In fact, it's already implemented! We did this with our own prototype multitouch display toy back in the day, but we were making up the event API as we went along and as was suitable for our hardware capabilities.

https://github.com/enthought/chaco/blob/master/examples/demo/canvas/mptools.py#L181

It looks like the standard Qt API for this is not quite a perfect match for what we've already implemented, so we probably ought to implement a new TouchEvent type from scratch that has a better impedance match. The fundamentals are close enough that rewriting those tools for a new TouchEvent will be easy enough.

https://github.com/enthought/enable/blob/master/enable/events.py#L179-L257 http://doc.qt.io/archives/qt-4.8/qtouchevent.html

We will need to check what the API is for wx.