TouchDataProvider
ClassThis 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 thro…
- Available on all platforms
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"
Index
Properties
Methods
Example
// 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;
Extends
Properties
touchBlocking
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.
Default Value
false
touchBlockingExceptionMask
touchBlockingExceptionMask:
number
The current touch mask.
Default Value
0
Methods
composeTouchBlockingExceptionMask()
composeTouchBlockingExceptionMask(
currentMask,newException):number
Returns a copy of currentMask with the newException flag set to true.
Parameters
| Parameter | Type |
|---|---|
currentMask | number |
newException | string |
Returns
number
enableTouchBlockingException()
enableTouchBlockingException(
exception,enable):void
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
| Parameter | Type |
|---|---|
exception | string |
enable | boolean |
Returns
void
getTypeName()
staticgetTypeName():TypeName<TouchDataProvider>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<TouchDataProvider>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean