Extends Gesture


A continuous gesture recognizer for panning (dragging) gestures. A pan begins when the specified number of touch points begin dragging and continues until the touch points are released.

If you are looking for a discrete swipe gesture, use Gesture.Swipe instead.

Item {
    with Gesture.Pan {
        minimumTouchesRequired: 2

        on panned(e) {
            System.log("Panned {0} points".arg(e.delta))

property Gesture.Pan.Orientation orientation: .HorizontalAndVertical

Sets the pan orientations the pan gesture accepts.




property Bool directionalLock: false

If this property is false, panning is permitted in both horizontal and vertical directions according to the orientation property. If this property is true and the user begins dragging in one general direction (horizontally or vertically), the pan interaction disables scrolling in the other direction. If the drag direction is diagonal, then panning will not be locked and the user can drag in any direction until the drag completes.

property Int minimumTouchesRequired: 1

property Int maximumTouchesAllowed: Int.Max

Configures the minimum and maximum number of touch points for the pan.

The pan will not begin until there are at least minimumTouchesRequired touch points. The gesture will not be recognized if there are more than maximumTouchesAllowed touch points.

For example, if you would like a single-finger only pan, you would set both the minimum and maximum to 1.

property Float totalXread only

property Float totalYread only

The total distance of the pan since it began.

If the pan is not in progress, these values are zero.

event started(Gesture.Pan.Event e)

event panned(Gesture.Pan.Event e)

event ended(Gesture.Pan.Event e)

property Bool isPanningread only

The started() event is emitted when the pan starts, the panned() event each time the pan location changes and the ended() event is emitted when the pan ends.

The Gesture.Pan.Event value contains details of the pan, such as the distance panned and the pan's instantaneous velocity.

The isPanning property is true while the pan is in progress, and false otherwise.