Page MenuHome

Trackpad: Fix 3D view navigation with Auto Depth enabled
Needs ReviewPublic

Authored by Yevgeny Makarov (jenkm) on Aug 31 2020, 2:59 PM.

Details

Summary

Improve trackpad navigation in 3D view with Auto Depth enabled.

T77509: Issues with using a Mac trackpad when the Auto Depth option is enabled

This patch allows the use of gesture phases for trackpad events,
such as begun or ended. It allows pick the depth point only once
when the user begins a new gesture. Just store and reuse the
previous data.

The gesture ends when you lift your fingers off.

https://developer.apple.com/documentation/appkit/nsevent/1533550-phase
https://developer.apple.com/documentation/appkit/nsevent/1525439-momentumphase
https://developer.apple.com/documentation/appkit/nseventphase

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) requested review of this revision.Aug 31 2020, 2:59 PM
Yevgeny Makarov (jenkm) created this revision.

Using static variables and timeouts is not ideal.

I think the proper solution is to:

  • Add information to trackpad events about the gesture starting / stopping (don't copy the entire macOS specific phase stuff)
  • Make the operator start running modal when the gesture starts, and end it when the gesture stops.
  • The modal operator for trackpad events should probably let other events pass through, so that other operations can be performed.

There are a lot of issues here:

  • When the phase ends we don't know if the momentum phase will start further. In this way, momentum phase will restart the operator with a new depth point.
  • Magnify and Rotate can be in progress at the same time, so if one of them was started but not finished the beginning of the second one should not change the depth point but change the operator to be executed.
  • Running in modal mode allows you to use modal shortcuts, but not all of them support working with the trackpad.
  • When the modal mode is activated it changes the status bar, what feels really bad when using the trackpad.
  • This will require changes for about four operators that use depth.
  • Also this is actually only required if Auto Depth is enabled, and it may not be supported by some devices e.g. tablets, so the current code should also be saved.

The current version may not be ideal, you can call it a temporary hack, but it allows you to comfortably use Auto Depth with minimal code changes.

We may want to use phases in the future and in other places, but I'm not sure we want to add gesture phases just to fix Auto Dept, which is why I created a simple version with a timer.

Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)