wgpu-py icon indicating copy to clipboard operation
wgpu-py copied to clipboard

Support for pinch events

Open almarklein opened this issue 1 year ago • 5 comments

Experimental PR to look into pinch events. See pygfx/rendercanvas#31

Status

Seems it can be made to work for Qt. Likely also for jupyter. Not (for now) on glfw. Also quite some work to do in pygfx. Looked into it, and made this PR to save what I found.

Tasks

  • [x] Implement for Qt.
  • [ ] Implement for wx?
  • [ ] Implement for glfw. Looks like we can't. https://github.com/glfw/glfw/issues/90
    • This is sad, because it makes code that uses pinch less portable.
  • [ ] Implement for jupyter_rfb.
  • [ ] Add modifiers and buttons to the event?
  • [ ] Add x and y to the event so it can be scoped to a viewport in pygfx?
  • [ ] In pygfx add support for pinch events.
  • [ ] Support pinch events in pygfx controllers.

almarklein avatar Jun 05 '24 11:06 almarklein

In my experience, at least on the web, instead of working with these high level gesture events and abstractions, you just work with pointer events and use the pointer IDs to discern the fingers.

Korijn avatar Jun 05 '24 12:06 Korijn

Yes, that moves some of the complexity to the application level, but it is more flexible. So an alternative approach would be to make Qt work for multi-touch events. The event spec already supports multi-touch events btw.

almarklein avatar Jun 05 '24 12:06 almarklein

1 year later we are somewhat back to this point as we add a few more complex interactions to our applications.

In the standard workflow, one uses the left mouse button (button 1) to click and pan.

However, as soon as you change what that mouse botton does, the only way you have to pan is to "scroll out and in", So we enabled middle click and drag, however, everybody knows that the interaction is awkward.

two finger gestures, would be much better since you can both have panning, and zooming.

just a little bump 1 year later.

hmaarrfk avatar May 31 '25 14:05 hmaarrfk

Correct me if I'm wrong: we already support events from multiple pointers (fingers), you just have to put the state management together yourself to implement higher level gestures like pinching to zoom. Events include a pointer id.

This PR is just about adding support for built in higher level gestures from GUI frameworks.

Right?

It's not very hard to do. If you want to have it. You don't have to wait for this PR.

Korijn avatar May 31 '25 19:05 Korijn

You may be right. I’ll boot up on windows to check

hmaarrfk avatar May 31 '25 19:05 hmaarrfk