interface PanHandlers {
    onPan?(event, info): void;
    onPanEnd?(event, info): void;
    onPanSessionStart?(event, info): void;
    onPanStart?(event, info): void;
}

Hierarchy (view full)

Methods

  • Callback function that fires when the pan gesture is recognised on this element.

    Note: For pan gestures to work correctly with touch input, the element needs touch scrolling to be disabled on either x/y or both axis with the touch-action CSS rule.

    function onPan(event, info) {
    console.log(info.point.x, info.point.y)
    }

    <motion.div onPan={onPan} />

    Parameters

    • event: PointerEvent

      The originating pointer event.

    • info: PanInfo

      A PanInfo object containing x and y values for:

      • point: Relative to the device or page.
      • delta: Distance moved since the last event.
      • offset: Offset from the original pan event.
      • velocity: Current velocity of the pointer.

    Returns void

  • Callback function that fires when the pan gesture ends on this element.

    function onPanEnd(event, info) {
    console.log(info.point.x, info.point.y)
    }

    <motion.div onPanEnd={onPanEnd} />

    Parameters

    • event: PointerEvent

      The originating pointer event.

    • info: PanInfo

      A PanInfo object containing x/y values for:

      • point: Relative to the device or page.
      • delta: Distance moved since the last event.
      • offset: Offset from the original pan event.
      • velocity: Current velocity of the pointer.

    Returns void

  • Callback function that fires when we begin detecting a pan gesture. This is analogous to onMouseStart or onTouchStart.

    function onPanSessionStart(event, info) {
    console.log(info.point.x, info.point.y)
    }

    <motion.div onPanSessionStart={onPanSessionStart} />

    Parameters

    • event: PointerEvent

      The originating pointer event.

    • info: EventInfo

      An EventInfo object containing x/y values for:

      • point: Relative to the device or page.

    Returns void

  • Callback function that fires when the pan gesture begins on this element.

    function onPanStart(event, info) {
    console.log(info.point.x, info.point.y)
    }

    <motion.div onPanStart={onPanStart} />

    Parameters

    • event: PointerEvent

      The originating pointer event.

    • info: PanInfo

      A PanInfo object containing x/y values for:

      • point: Relative to the device or page.
      • delta: Distance moved since the last event.
      • offset: Offset from the original pan event.
      • velocity: Current velocity of the pointer.

    Returns void

Generated using TypeDoc