A continuous gesture recognizer for panning (dragging) gestures.


@interface NSPanGestureRecognizer : NSGestureRecognizer


The gesture is recognized when the user clicks all of specified buttons, drags the mouse, and releases one or more of the buttons. Use the pan gesture recognizer object to retrieve the distance traveled during the pan and the location of the mouse as it pans.

Upon creation, the gesture recognizer is configured to recognize pan gestures involving only the primary button. It also delays sending primary button events to the view by setting the delaysPrimaryMouseButtonEvents property to YES. To change the set of buttons to track, modify the buttonMask property.

In this gesture recognizer, the locationInView: method always reports the current mouse point, which changes as the user drags the mouse.


Configuring the Gesture Recognizer


A bit mask of the button (or buttons) required to recognize this gesture.

Tracking the Location and Velocity of the Gesture

- translationInView:

The distance traveled by the mouse during the gesture.

- setTranslation:inView:

Changes the current translation value of the gesture recognizer.

- velocityInView:

The velocity of the pan, measured in points per second.

Instance Properties


The number of touches required in an NSTouchBar object for the gesture recognizer to match.


Inherits From

Conforms To

See Also

Standard Gestures


A discrete gesture recognizer that tracks a specified number of mouse clicks.


A discrete gesture recognizer that tracks whether the user held down a mouse button for a minimum amount of time before releasing it.


A continuous gesture recognizer that tracks two trackpad touches moving opposite each other in a circular motion.


A continuous gesture recognizer that tracks a pinch gesture used to magnify content.