Ejemplo n.º 1
0
  private int checkBordersX(float scaleFactor, int xPos) {

    if ((mImageViewBase.getImageWidth() + xPos) * scaleFactor < mImageViewBase.getFrameWidth()) {
      xPos = (int) (mImageViewBase.getFrameWidth() / scaleFactor - mImageViewBase.getImageWidth());
    }

    if (xPos > 0) {
      xPos = 0;
    }

    return xPos;
  }
Ejemplo n.º 2
0
  private int checkBordersY(float scaleFactor, int yPos) {

    if ((mImageViewBase.getImageHeight() + yPos) * scaleFactor < mImageViewBase.getFrameHeigth()) {
      yPos =
          (int) (mImageViewBase.getFrameHeigth() / scaleFactor - mImageViewBase.getImageHeight());
    }

    if (yPos > 0) {
      yPos = 0;
    }

    return yPos;
  }
Ejemplo n.º 3
0
  private void pan(float dx, float dy, float scaleFactor, int xPos, int yPos) {

    // compute new position
    xPos += dx / scaleFactor;
    yPos += dy / scaleFactor;

    // check if we meet border
    xPos = checkBordersX(scaleFactor, xPos);
    yPos = checkBordersY(scaleFactor, yPos);

    // update position
    mImageViewBase.setImageXPosition(xPos);
    mImageViewBase.setImageYPosition(yPos);
  }