ZoomViewTouchable.java 文件源码

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

项目:ZoomableView 作者:
private void restoreInitialPosition() {
    // Will start animation for the image to return in its bounds
    updateDiffRect();
    if (rectMap.width() < getWidth()) {
        rectMapUpdate.offset(-rectMap.centerX() + rectView.centerX(), 0);
    } else if (rectMap.left > 0) {
        rectMapUpdate.offset(-rectMap.left, 0);
    } else if (rectMap.right < getWidth()) {
        rectMapUpdate.offset(getWidth() - rectMap.right, 0);
    }

    if (rectMap.height() < getHeight()) {
        rectMapUpdate.offset(0, -rectMap.centerY() + rectView.centerY());
    } else if (rectMap.top > 0) {
        rectMapUpdate.offset(0, -rectMap.top);
    } else if (rectMap.bottom < getHeight()) {
        rectMapUpdate.offset(0, getHeight() - rectMap.bottom);
    }

    if (!equalsRect(rectMapUpdate, rectMap)) {
        // Create matrix for translation from current rect to new rect
        matrixTranslate.setRectToRect(rectMapOrigin, rectMapUpdate, ScaleToFit.FILL);
        mapScaleAnim = new ZoomScaleAnim(matrix, matrixTranslate, 200);
        startZoomAnimation();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号