Skip to content

Commit

Permalink
fixed shaky zoom bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeOrtiz committed Sep 19, 2011
1 parent e80a46b commit c357c0d
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 20 deletions.
Empty file added README~
Empty file.
Binary file modified bin/TouchImageView.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/com/example/touch/TouchImageView$1.class
Binary file not shown.
Binary file modified bin/com/example/touch/TouchImageView$ScaleListener.class
Binary file not shown.
Binary file modified bin/com/example/touch/TouchImageView.class
Binary file not shown.
20 changes: 0 additions & 20 deletions src/com/example/touch/TouchImageView.java
Expand Up @@ -39,7 +39,6 @@ public class TouchImageView extends ImageView {
static final int CLICK = 3;
float saveScale = 1f;
float right, bottom, origWidth, origHeight, bmWidth, bmHeight;
boolean snapEquilibrium = false;

ScaleGestureDetector mScaleDetector;

Expand Down Expand Up @@ -117,7 +116,6 @@ else if (y + deltaY < -bottom)

case MotionEvent.ACTION_POINTER_UP:
mode = NONE;
snapEquilibrium = false;
break;
}
setImageMatrix(matrix);
Expand Down Expand Up @@ -162,23 +160,6 @@ public boolean onScale(ScaleGestureDetector detector) {
right = width * saveScale - width - (2 * redundantXSpace * saveScale);
bottom = height * saveScale - height - (2 * redundantYSpace * saveScale);
if (origWidth * saveScale <= width || origHeight * saveScale <= height) {
if (snapEquilibrium) {
matrix.getValues(m);
float x = m[Matrix.MTRANS_X];
float y = m[Matrix.MTRANS_Y];
if (origScale * origWidth > width && saveScale * origWidth <= width) {
saveScale = width / origWidth;
mScaleFactor = saveScale / origScale;
matrix.postTranslate(-x, 0);
} else {
saveScale = height / origHeight;
mScaleFactor = saveScale / origScale;
matrix.postTranslate(0, -y);
}
matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY());
snapEquilibrium = false;
return true;
}
matrix.postScale(mScaleFactor, mScaleFactor, width / 2, height / 2);
if (mScaleFactor < 1) {
matrix.getValues(m);
Expand All @@ -199,7 +180,6 @@ else if (x > 0)
}
}
} else {
snapEquilibrium = true;
matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY());
matrix.getValues(m);
float x = m[Matrix.MTRANS_X];
Expand Down

0 comments on commit c357c0d

Please sign in to comment.