LeftIndicatorViewGroup.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:LeftIndicatorViewGroup 作者:
/**
 * genearate samll points.
 *
 * @param bigStart prev big circle position.
 * @param current  current big circle position.
 */
private void generateSmallPoints(float bigStart, float current) {
    // location start.
    float smallStart = bigStart + mHalfBigHeight;
    // location end.
    float smallEnd = current - mHalfBigHeight;
    float smallHeight = mHalfSmallHeight * 2 + mSmallDistance * 2;
    // if has space.
    if (smallEnd - smallStart < smallHeight) {
        return;
    }
    // half of top points.
    float halfTop = (bigStart + current) / 2 - mHalfSmallHeight - mSmallDistance;
    while (halfTop - smallStart >= smallHeight) {
        mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(), halfTop - smallHeight / 2));
        halfTop -= smallHeight;
    }
    // does need extra.
    if (halfTop - smallStart >= smallHeight - mSmallDistance + mBigAndSmallOffset) {
        mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(), halfTop - smallHeight / 2));
    }

    // center.
    mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(), (bigStart + current) / 2));
    // half bottom points.
    float halfBottom = (bigStart + current) / 2 + mHalfSmallHeight + mSmallDistance;
    while (halfBottom + smallHeight <= smallEnd) {
        mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(), halfBottom + smallHeight / 2));
        halfBottom += smallHeight;
    }
    // does need extra.
    if (halfBottom + smallHeight - mSmallDistance + mBigAndSmallOffset <= smallEnd) {
        mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(), halfBottom + smallHeight / 2));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号