Page MenuHome

MacOS: Trackpad smart zoom gesture implementation

Authored by Yevgeny Makarov (jenkm) on Jan 15 2020, 10:47 AM.



The smart zoom gesture (NSEventTypeSmartMagnify event) is a two-finger double tap on trackpads.

In response to this event, you should magnify the content appropriately for your app. For example, you might zoom in on a specific paragraph or image.

Can be used for quick zoom in (for example, node under cursor) and back out.
For patch testing, it is used for "view3d.localview".

Diff Detail

rB Blender

Event Timeline

Can you provide exact steps on how to test this? Thanks :)

  • This is a two-finger double tap on trackpads.
  • Check if the "Smart Zoom" enabled in macOS System Preferences > Trackpad > Scroll & Zoom.
  • You can set "Mouse/Trackpad Smart Zoom" (value must be ANY) in keymap to any action (for example, opening/closing the sidebar).
  • It is already set for "Local View" operator in this patch.

I wonder if it makes more sense to map it to Frame Selected instead? That seems more consistent with the macOS behavior.

Tested - View Selected doesn't work so well because it doesn't toggle. Local View therefore works better in practice. Seems ok with me.

This revision is now accepted and ready to land.Thu, Jan 23, 4:08 PM

In any case, "Local View" is only for testing, this patch is only for adding NSEventTypeSmartMagnify event, opportunities to use it in the future.

Brecht Van Lommel (brecht) requested changes to this revision.Mon, Jan 27, 4:52 PM

Seems fine overall.

Using it for local view immediately is fine with me if @William Reynish (billreynish) thinks it works well.


Don't change values of existing events, they are saved to preferences and so should remain backwards compatible.

This revision now requires changes to proceed.Mon, Jan 27, 4:52 PM
Yevgeny Makarov (jenkm) marked an inline comment as done.
This revision is now accepted and ready to land.Mon, Jan 27, 6:02 PM