Lens Scripting API

    Class TouchDataProvider

    This provider is returned by global.touchSystem and allows your lens to handle any touches on the screen, and optionally let certain touch types to pass through (let Snapchat handle the touch).

    Possible TouchType exception values:

    "TouchTypeNone" "TouchTypeTouch" "TouchTypeTap" "TouchTypeDoubleTap" "TouchTypeScale" "TouchTypePan" "TouchTypeSwipe"

    // Enable full screen touches
    global.touchSystem.touchBlocking = true;

    // Allow double-tap to be passed through to Snapchat to flip the camera.
    global.touchSystem.enableTouchBlockingException("TouchTypeDoubleTap", true);

    // Or alternatively enable "TouchTypeDoubleTap" using mask
    var mask = global.touchSystem.touchBlockingExceptionMask;
    mask = global.touchSystem.composeTouchBlockingExceptionMask(mask, "TouchTypeDoubleTap");
    global.touchSystem.touchBlockingExceptionMask = mask;

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    touchBlocking: boolean

    Set your lens to handle touches on the screen, preventing default Snapchat touch behavior from occuring. Useful for enabling full screen touches without any touch components. It is similar to creating a plane the size of the screen in front of the camera.

    touchBlockingExceptionMask: number

    The current touch mask.

    Methods

    • Returns a copy of currentMask with the newException flag set to true.

      Parameters

      • currentMask: number
      • newException: string

      Returns number

    • Allow or stop allowing a certain TouchType to pass through your lens. Useful for allowing Snapchat to handle certain TouchType, e.g. allowing TouchTypeDoubleTap to flip the camera.

      Parameters

      • exception: string
      • enable: boolean

      Returns void

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    MMNEPVFCICPMFPCPTTAAATR