touchX method

double touchX(
  1. int index
)

Returns the x coordinate of the finger on a touch screen device.

The index is the order of the touches that have been made. The first finger that touches the screen will be assigned index 0. The next finger will be assigned 1 and so on.

Implementation

double touchX(int index) {
  if (index == 0 && _touchState.isEmpty) {
    return x;
  }

  if (index < 0 || index >= _touchState.length) {
    return 0;
  }

  return _touchState[index].x;
}