Ejemplo n.º 1
0
 public void scale(float scale, boolean checkScale) {
   Log.i(
       TAG,
       "Before setScale scale = "
           + scale
           + " getMaxScaleValue = "
           + getMaxScaleValue()
           + " getMinScaleValue = "
           + getMinScaleValue());
   if (checkScale) {
     float scaleValue = mCurrentScaleValue * scale;
     // check max scale value
     if (scale > 1) {
       scale = scaleValue > getMaxScaleValue() ? 1f : scale;
     }
     // check minimal scale value
     if (scale < 1) {
       scale = scaleValue < getMinScaleValue() ? 1f : scale;
     }
     mCurrentScaleValue = mCurrentScaleValue * scale;
   }
   Log.i(TAG, "setScale mCurrentScaleValue = " + mCurrentScaleValue);
   mAnimationMatrix.reset();
   mAnimationMatrix.setScale(scale, scale, mRectF.centerX(), mRectF.centerY());
   mAnimationMatrix.mapRect(mRectF);
   setVetex(mRectF.left, mRectF.top, mRectF.right, mRectF.bottom);
   mOriginalDistance =
       (float)
           Math.sqrt(
               (centerX() - rightBottom[0]) * (centerX() - rightBottom[0])
                   + (centerY() - rightBottom[1]) * (centerY() - rightBottom[1]));
   Log.i(TAG, "After setScale scale = " + scale);
 }
Ejemplo n.º 2
0
 public void translate(float dx, float dy, boolean checkTranslate) {
   mAnimationMatrix.reset();
   mAnimationMatrix.setTranslate(dx, dy);
   mAnimationMatrix.mapRect(mRectF);
   if (checkTranslate) {
     checkTranslate();
   }
   setVetex(mRectF.left, mRectF.top, mRectF.right, mRectF.bottom);
 }
Ejemplo n.º 3
0
 public void initialize(float mLeft, float mTop, float mRight, float mBottom) {
   mRectF.set(mLeft, mTop, mRight, mBottom);
   setVetex(mRectF.left, mRectF.top, mRectF.right, mRectF.bottom);
   mOriginalDistance =
       (float)
           Math.sqrt(
               (centerX() - rightBottom[0]) * (centerX() - rightBottom[0])
                   + (centerY() - rightBottom[1]) * (centerY() - rightBottom[1]));
 }
Ejemplo n.º 4
0
 public void rotate(float degrees, float centerX, float centerY) {
   Log.i(TAG, "setRotate");
   setVetex(mRectF.left, mRectF.top, mRectF.right, mRectF.bottom);
   mAnimationMatrix.reset();
   mAnimationMatrix.setRotate(degrees, centerX, centerY);
   mAnimationMatrix.mapPoints(leftTop);
   mAnimationMatrix.mapPoints(rightTop);
   mAnimationMatrix.mapPoints(leftBottom);
   mAnimationMatrix.mapPoints(rightBottom);
   mCurrentRotationValue = degrees;
 }