Type | function |
Library | simple_gesture.* |
Return value | nil |
Keywords | simple, gesture, valid |
See also | Sample code, simple_gesture.getValidGestures(), simple_gesture.getSupportedGestures(), simple_gesture.gestureListener() |
This function sets the valid gestures that can be returned by simple_gesture.gestureListener(). These must be either custom-defined gestures or supported, built-in gestures. A runtime error is raised if an unsupported gesture is specified.
simple_gesture.setValidGestures( gestureArray )
simple_gesture.setValidGestures( gestureTable )
Array. Array of string values that must be supported gesture types, as reported by simple_gesture.getSupportedGestures()
Table. Used as an alternative to gestureArray for overriding the supported, built-in gestures. The keys are the names of the newly-defined gestures, and the values are Arrays, comprising the x and y coordinates of points on the unit circle.
local simple_gesture = require 'plugin.simple_gesture'
-- Set gestures from the supported, built-in gestures
simple_gesture.setValidGestures({"up", "down", "left", "right"})
local simple_gesture = require 'plugin.simple_gesture'
local math = require 'math'
local root2 = math.sqrt(2)
-- Define your own custom gestures
simple_gesture.setValidGestures({up_left={-root2, -root2}, down_left={-root2, root2}, right={1, 0}})