handleTouchEvent method
Handle a touch event.
Parameters
** IN** pointerIndex The pointer index of the touch event ** IN** touchType The type of the touch event. 0 = down, 1 = move, 2 = up, 3 = cancel ** IN** x The x coordinate of the touch event ** IN** y The y coordinate of the touch event
Returns
- GemError.success if successful
- GemError.activation if the map is invalid
- GemError.inUse if another operation is in progress
- GemError if other error codes are returned
Throws
- An exception if it fails.
Implementation
GemError handleTouchEvent(
final int pointerIndex,
final int touchType,
final int x,
final int y,
) {
if (GemKitPlatform.instance.androidVersion > -1) {
unawaited(
GemKitPlatform.instance.getChannel(mapId: mapId).invokeMethod(
'handleTouchEvent',
jsonEncode(<String, int>{
'x': x,
'y': y,
'touchType': touchType,
'pointerIndex': pointerIndex,
}),
),
);
return GemError.success;
}
unawaited(
GemKitPlatform.instance.getChannel(mapId: mapId).invokeMethod<String>(
'callObjectMethod',
jsonEncode(<String, dynamic>{
'id': _pointerId,
'class': 'MapView',
'method': 'handleTouchEvent',
"args": <String, dynamic>{
'x': x,
'y': y,
'touchType': touchType,
'pointerIndex': pointerIndex,
},
}),
));
return GemError.success;
// final OperationResult resultString = objectMethod(
// _pointerId,
// 'MapView',
// 'handleTouchEvent',
// );
// return GemErrorExtension.fromCode(resultString['gemApiError']);
}