handleGestureEvent method

Future<void> handleGestureEvent(
  1. Gesture gesture, {
  2. ScrollController? scrollController,
  3. AxisDirection direction = AxisDirection.down,
})

Implementation

Future<void> handleGestureEvent(
  Gesture gesture, {
  ScrollController? scrollController,
  AxisDirection direction = AxisDirection.down,
}) async {
  var touchPoint = _getActualOffsetFromScrollController(
      TouchCanvasUtil.getPointFromGestureDetail(gesture.gestureDetail),
      scrollController,
      direction);
  if (!_registeredGestures.contains(gesture.gestureType)) return;

  var touchedShapes = _getTouchedShapes(touchPoint);
  if (touchedShapes.isEmpty) return;
  for (var touchedShape in touchedShapes) {
    if (touchedShape.registeredGestures.contains(gesture.gestureType)) {
      var callback = touchedShape.getCallbackFromGesture(gesture);
      callback();
    }
  }
}