calculateSelectedX method

int calculateSelectedX(
  1. double selectX
)

calculate the value of x after long pressing and convert to index

Implementation

int calculateSelectedX(double selectX) {
  int mSelectedIndex = indexOfTranslateX(xToTranslateX(selectX));
  if (mSelectedIndex < mStartIndex) {
    mSelectedIndex = mStartIndex;
  }
  if (mSelectedIndex > mStopIndex) {
    mSelectedIndex = mStopIndex;
  }
  return mSelectedIndex;
}