ArkUI_NativeGestureAPI_1

Struct ArkUI_NativeGestureAPI_1 

Source
#[repr(C)]
pub struct ArkUI_NativeGestureAPI_1 {
Show 18 fields pub version: i32, pub createTapGesture: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32) -> *mut ArkUI_GestureRecognizer>, pub createLongPressGesture: Option<unsafe extern "C" fn(fingersNum: i32, repeatResult: bool, durationNum: i32) -> *mut ArkUI_GestureRecognizer>, pub createPanGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>, pub createPinchGesture: Option<unsafe extern "C" fn(fingersNum: i32, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>, pub createRotationGesture: Option<unsafe extern "C" fn(fingersNum: i32, angleNum: f64) -> *mut ArkUI_GestureRecognizer>, pub createSwipeGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, speedNum: f64) -> *mut ArkUI_GestureRecognizer>, pub createGroupGesture: Option<unsafe extern "C" fn(gestureMode: ArkUI_GroupGestureMode) -> *mut ArkUI_GestureRecognizer>, pub dispose: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer)>, pub addChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>, pub removeChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>, pub setGestureEventTarget: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer, actionTypeMask: ArkUI_GestureEventActionTypeMask, extraParams: *mut c_void, targetReceiver: Option<unsafe extern "C" fn(event: *mut ArkUI_GestureEvent, extraParams: *mut c_void)>) -> i32>, pub addGestureToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer, mode: ArkUI_GesturePriority, mask: ArkUI_GestureMask) -> i32>, pub removeGestureFromNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer) -> i32>, pub setGestureInterrupterToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, interrupter: Option<unsafe extern "C" fn(info: *mut ArkUI_GestureInterruptInfo) -> ArkUI_GestureInterruptResult>) -> i32>, pub getGestureType: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer) -> ArkUI_GestureRecognizerType>, pub setInnerGestureParallelTo: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, userData: *mut c_void, parallelInnerGesture: Option<unsafe extern "C" fn(event: *mut ArkUI_ParallelInnerGestureEvent) -> *mut ArkUI_GestureRecognizer>) -> i32>, pub createTapGestureWithDistanceThreshold: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32, distanceThreshold: f64) -> *mut ArkUI_GestureRecognizer>,
}
Available on crate feature api-12 only.
Expand description

Defines the gesture APIs.

Available since API-level: 12

Fields§

§version: i32

The struct version is 1.

§createTapGesture: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32) -> *mut ArkUI_GestureRecognizer>

Creates a tap gesture.

  1. This API is used to trigger a tap gesture with one, two, or more taps.

  2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.

  3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, gesture recognition fails.

  4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers touching the screen within 300 ms of the first finger touch is less than the required number,

or when the number of fingers lifted from the screen within 300 ms of the first finger’s being lifted is less than the required number.

  1. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized.

§Arguments

  • countNum - Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default value 1 is used.

  • fingersNum - Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value 1 is used.

§Returns

  • Returns the pointer to the created gesture.
§createLongPressGesture: Option<unsafe extern "C" fn(fingersNum: i32, repeatResult: bool, durationNum: i32) -> *mut ArkUI_GestureRecognizer>

Creates a long press gesture.

  1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum The value ranges 500 ms hold-down time.

  2. In components that support drag actions by default, such as , ,