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(dx, dy) {
            System.log("Panned {0}x{0} points".arg(dx, dy))

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()

event panned(Float deltaX, Float deltaY)

event ended()

property Bool isPanningread only

The started() event is emitted when the pan starts.

The panned() event is emitted each time the pan location changes. The deltaX and deltaY arguments contain the delta in points since the previous panned() event.

The ended() event is emitted when the pan ends.

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