calculateSelectedX method

int calculateSelectedX(
  1. double selectX
)

计算长按后x的值,转换为index

Implementation

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